You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2015/11/11 21:44:10 UTC

svn commit: r1713930 - in /maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help: ActiveProfilesMojo.java SystemMojo.java

Author: michaelo
Date: Wed Nov 11 20:44:10 2015
New Revision: 1713930

URL: http://svn.apache.org/viewvc?rev=1713930&view=rev
Log:
[MPH-109] Use ISO 8601 date format for the remaining goals

Modified:
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java?rev=1713930&r1=1713929&r2=1713930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java Wed Nov 11 20:44:10 2015
@@ -23,11 +23,11 @@ import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.maven.model.Profile;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
@@ -73,9 +73,10 @@ public class ActiveProfilesMojo
 
         if ( output != null )
         {
+            String formattedDateTime = DateFormatUtils.ISO_DATETIME_FORMAT.format( System.currentTimeMillis() );
             StringBuilder sb = new StringBuilder();
             sb.append( "Created by: " ).append( getClass().getName() ).append( "\n" );
-            sb.append( "Created on: " ).append( new Date() ).append( "\n" ).append( "\n" );
+            sb.append( "Created on: " ).append( formattedDateTime ).append( "\n" ).append( "\n" );
             sb.append( message.toString() );
 
             try
@@ -114,7 +115,7 @@ public class ActiveProfilesMojo
     private void getActiveProfileStatement( MavenProject project, StringBuilder message )
     {
         Map<String, List<String>> activeProfileIds = new LinkedHashMap<String, List<String>>();
-        try 
+        try
         {
             activeProfileIds.putAll( getInjectedProfileIds( project ) );
         }
@@ -123,7 +124,7 @@ public class ActiveProfilesMojo
             // Fall back to M2 approach
             @SuppressWarnings( "unchecked" )
             List<Profile> profiles = new ArrayList<Profile>( project.getActiveProfiles() );
-            
+
             for ( Profile profile : profiles )
             {
                 List<String> profileIds = activeProfileIds.get( profile.getSource() );
@@ -135,7 +136,7 @@ public class ActiveProfilesMojo
                 profileIds.add( profile.getId() );
             }
         }
-        
+
 
         message.append( "\n" );
 

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java?rev=1713930&r1=1713929&r2=1713930&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/SystemMojo.java Wed Nov 11 20:44:10 2015
@@ -19,13 +19,13 @@ package org.apache.maven.plugins.help;
  * under the License.
  */
 
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineUtils;
 
 import java.io.IOException;
-import java.util.Date;
 import java.util.Properties;
 
 /**
@@ -98,9 +98,10 @@ public class SystemMojo
 
         if ( output != null )
         {
+            String formattedDateTime = DateFormatUtils.ISO_DATETIME_FORMAT.format( System.currentTimeMillis() );
             StringBuilder sb = new StringBuilder();
             sb.append( "Created by: " ).append( getClass().getName() ).append( "\n" );
-            sb.append( "Created on: " ).append( new Date() ).append( "\n" ).append( "\n" );
+            sb.append( "Created on: " ).append( formattedDateTime ).append( "\n" ).append( "\n" );
             sb.append( message.toString() );
 
             try