You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2022/08/05 14:59:27 UTC

[maven-help-plugin] branch MPH-189 updated (4be1283 -> 2b3d3c8)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MPH-189
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git


 discard 4be1283  WIP.
 discard f6d4181  WIP.
     new 2b3d3c8  [MPH-189] - Get rid of commons-lang3

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4be1283)
            \
             N -- N -- N   refs/heads/MPH-189 (2b3d3c8)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[maven-help-plugin] 01/01: [MPH-189] - Get rid of commons-lang3

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MPH-189
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git

commit 2b3d3c8be39d92af586e2f72e3d2155bfa9226df
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Thu Aug 4 21:08:42 2022 +0200

    [MPH-189] - Get rid of commons-lang3
---
 .../apache/maven/plugins/help/AbstractHelpMojo.java   | 19 +++++++++++++++++--
 .../apache/maven/plugins/help/ActiveProfilesMojo.java |  7 ++-----
 .../org/apache/maven/plugins/help/SystemMojo.java     | 11 ++++-------
 .../maven/plugins/help/ActiveProfilesMojoTest.java    |  2 +-
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
index 0f079ff..06cd1a5 100644
--- a/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/AbstractHelpMojo.java
@@ -46,6 +46,11 @@ import org.eclipse.aether.resolution.ArtifactRequest;
 import java.io.File;
 import java.io.IOException;
 import java.io.Writer;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.List;
 
 /**
@@ -61,8 +66,11 @@ public abstract class AbstractHelpMojo
     protected static final int LINE_LENGTH = 79;
     
     /** The line separator for the current OS. */
-    protected static final String LS = System.getProperty( "line.separator" );
-    
+    protected static final String LS = System.lineSeparator();
+
+    protected static final DateTimeFormatter DATE_TIME_FORMATTER =
+            DateTimeFormatter.ofPattern( "YYYY-MM-dd'T'HH:mm:ssxxxxx" );
+
     /**
      * Maven Project Builder component.
      */
@@ -108,6 +116,13 @@ public abstract class AbstractHelpMojo
     @Parameter( property = "output" )
     protected File output;
 
+    protected static String formatCurrentMillis( )
+    {
+        ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant( Instant.ofEpochMilli( System.currentTimeMillis() ),
+                ZoneId.from( ZoneOffset.UTC ) );
+        return DATE_TIME_FORMATTER.format( zonedDateTime );
+    }
+
     /**
      * Utility method to write a content in a given file.
      *
diff --git a/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java b/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
index 326ee9c..996044a 100644
--- a/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/ActiveProfilesMojo.java
@@ -23,7 +23,6 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -67,12 +66,10 @@ public class ActiveProfilesMojo
 
         if ( output != null )
         {
-            String formattedDateTime = DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT
-                .format( System.currentTimeMillis() );
             StringBuilder sb = new StringBuilder();
             sb.append( "Created by: " ).append( getClass().getName() ).append( LS );
-            sb.append( "Created on: " ).append( formattedDateTime ).append( LS ).append( LS );
-            sb.append( message.toString() );
+            sb.append( "Created on: " ).append( formatCurrentMillis() ).append( LS ).append( LS );
+            sb.append( message );
 
             try
             {
diff --git a/src/main/java/org/apache/maven/plugins/help/SystemMojo.java b/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
index 85973e9..703d639 100644
--- a/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/SystemMojo.java
@@ -19,15 +19,14 @@ package org.apache.maven.plugins.help;
  * under the License.
  */
 
-import org.apache.commons.lang3.time.DateFormatUtils;
+import java.io.IOException;
+import java.util.Properties;
+
 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.Properties;
-
 /**
  * Displays a list of the platform details like system properties and environment variables.
  *
@@ -92,11 +91,9 @@ public class SystemMojo
 
         if ( output != null )
         {
-            String formattedDateTime = DateFormatUtils.ISO_8601_EXTENDED_DATETIME_TIME_ZONE_FORMAT
-                .format( System.currentTimeMillis() );
             StringBuilder sb = new StringBuilder();
             sb.append( "Created by: " ).append( getClass().getName() ).append( LS );
-            sb.append( "Created on: " ).append( formattedDateTime ).append( LS ).append( LS );
+            sb.append( "Created on: " ).append( formatCurrentMillis() ).append( LS ).append( LS );
             sb.append( message.toString() );
 
             try
diff --git a/src/test/java/org/apache/maven/plugins/help/ActiveProfilesMojoTest.java b/src/test/java/org/apache/maven/plugins/help/ActiveProfilesMojoTest.java
index 6d70fd2..5f7490a 100644
--- a/src/test/java/org/apache/maven/plugins/help/ActiveProfilesMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/help/ActiveProfilesMojoTest.java
@@ -95,7 +95,7 @@ public class ActiveProfilesMojoTest
         Map<String, List<String>> profiles = new HashMap<>();
         profiles.put( "external", externals ); // from settings
         profiles.put( "org.apache.maven.test:test:1.0", pom ); // from POM
-        profiles.put( "", Collections.<String>emptyList() ); // from super POM
+        profiles.put( "", Collections.emptyList() ); // from super POM
         return profiles;
     }