Author: michaelo
Date: Wed Feb 10 19:55:00 2016
New Revision: 1729709
URL: http://svn.apache.org/viewvc?rev=1729709&view=rev
Log:
Fix inproper ISO 8601 date format in site:effective-site
Modified:
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/descriptor/EffectiveSiteMojo.java
Modified:
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/descriptor/EffectiveSiteMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/descriptor/EffectiveSiteMojo.java?rev=1729709&r1=1729708&r2=1729709&view=diff
==============================================================================
---
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/descriptor/EffectiveSiteMojo.java
(original)
+++
maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/descriptor/EffectiveSiteMojo.java
Wed Feb 10 19:55:00 2016
@@ -23,10 +23,8 @@ import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.maven.doxia.site.decoration.DecorationModel;
import org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Writer;
import org.apache.maven.plugin.MojoExecutionException;
@@ -67,16 +65,16 @@ public class EffectiveSiteMojo
throws MojoExecutionException, MojoFailureException
{
DecorationModel decorationModel = prepareDecorationModel(
getLocales().get( 0 ) );
-
+
StringWriter w = new StringWriter();
XMLWriter writer =
new PrettyPrintXMLWriter( w, StringUtils.repeat( " ",
XmlWriterUtil.DEFAULT_INDENTATION_SIZE ),
decorationModel.getModelEncoding(), null
);
-
+
writeHeader( writer );
-
+
writeEffectiveSite( decorationModel, writer );
-
+
String effectiveSite = w.toString();
if ( output != null )
@@ -119,11 +117,9 @@ public class EffectiveSiteMojo
{
XmlWriterUtil.writeCommentLineBreak( writer );
XmlWriterUtil.writeComment( writer, " " );
- // Use ISO8601-format for date and time
- DateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd'T'hh:mm:ss"
);
- XmlWriterUtil.writeComment( writer,
- "Generated by Maven Site Plugin on "
- + dateFormat.format( new Date(
System.currentTimeMillis() ) ) );
+ // Use ISO 8601 format for date and time
+ String formattedDateTime = DateFormatUtils.ISO_DATETIME_FORMAT.format(
System.currentTimeMillis() );
+ XmlWriterUtil.writeComment( writer, "Generated by Maven Site Plugin on
" + formattedDateTime );
XmlWriterUtil.writeComment( writer, "See:
http://maven.apache.org/plugins/maven-site-plugin/" );
XmlWriterUtil.writeComment( writer, " " );
XmlWriterUtil.writeCommentLineBreak( writer );