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 2019/03/23 09:40:48 UTC

[maven-dependency-plugin] branch IMPROVED_CODE updated (8c6cff0 -> f9e7062)

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

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


 discard 8c6cff0  - Refactored code.
     new f9e7062  - Refactored code.

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   (8c6cff0)
            \
             N -- N -- N   refs/heads/IMPROVED_CODE (f9e7062)

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:
 .../dependency/analyze/AnalyzeDuplicateMojo.java   | 31 +++++++++++++---------
 1 file changed, 18 insertions(+), 13 deletions(-)


[maven-dependency-plugin] 01/01: - Refactored code.

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

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

commit f9e70624cbe85a88bdfbb65c05c4d067bcf8870b
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sat Mar 23 09:21:06 2019 +0100

    - Refactored code.
---
 .../dependency/analyze/AnalyzeDuplicateMojo.java   | 69 +++++++++++-----------
 1 file changed, 33 insertions(+), 36 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
index 09e5ea6..3c17ac3 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeDuplicateMojo.java
@@ -50,6 +50,12 @@ import org.codehaus.plexus.util.ReaderFactory;
 public class AnalyzeDuplicateMojo
     extends AbstractMojo
 {
+    public static final String MESSAGE_DUPLICATE_DEP_IN_DEPENDENCIES =
+        "List of duplicate dependencies defined in <dependencies/> in your pom.xml:\n";
+
+    public static final String MESSAGE_DUPLICATE_DEP_IN_DEPMGMT =
+        "List of duplicate dependencies defined in <dependencyManagement/> in your pom.xml:\n";
+
     /**
      * Skip plugin execution completely.
      *
@@ -113,47 +119,39 @@ public class AnalyzeDuplicateMojo
         {
             StringBuilder sb = new StringBuilder();
 
-            if ( !duplicateDependencies.isEmpty() )
-            {
-                sb.append( "List of duplicate dependencies defined in <dependencies/> in your pom.xml:\n" );
-                for ( Iterator<String> it = duplicateDependencies.iterator(); it.hasNext(); )
-                {
-                    String dup = it.next();
+            createMessage( duplicateDependencies, sb, MESSAGE_DUPLICATE_DEP_IN_DEPENDENCIES );
+            createMessage( duplicateDependenciesManagement, sb, MESSAGE_DUPLICATE_DEP_IN_DEPMGMT );
 
-                    sb.append( "\to " ).append( dup );
-                    if ( it.hasNext() )
-                    {
-                        sb.append( "\n" );
-                    }
-                }
+            if ( sb.length() > 0 )
+            {
+                getLog().info( sb.toString() );
             }
-
-            if ( !duplicateDependenciesManagement.isEmpty() )
+            else
             {
-                if ( sb.length() > 0 )
-                {
-                    sb.append( "\n" );
-                }
-                sb.append( "List of duplicate dependencies defined in <dependencyManagement/> in your pom.xml:\n" );
-                for ( Iterator<String> it = duplicateDependenciesManagement.iterator(); it.hasNext(); )
-                {
-                    String dup = it.next();
-
-                    sb.append( "\to " ).append( dup );
-                    if ( it.hasNext() )
-                    {
-                        sb.append( "\n" );
-                    }
-                }
+                getLog().info( "No duplicate dependencies found in <dependencies/> or in <dependencyManagement/>" );
             }
+        }
+    }
 
+    private void createMessage( Set<String> duplicateDependencies, StringBuilder sb,
+                                String messageDuplicateDepInDependencies )
+    {
+        if ( !duplicateDependencies.isEmpty() )
+        {
             if ( sb.length() > 0 )
             {
-                getLog().info( sb.toString() );
+                sb.append( "\n" );
             }
-            else
+            sb.append( messageDuplicateDepInDependencies );
+            for ( Iterator<String> it = duplicateDependencies.iterator(); it.hasNext(); )
             {
-                getLog().info( "No duplicate dependencies found in <dependencies/> or in <dependencyManagement/>" );
+                String dup = it.next();
+
+                sb.append( "\to " ).append( dup );
+                if ( it.hasNext() )
+                {
+                    sb.append( "\n" );
+                }
             }
         }
     }
@@ -166,10 +164,9 @@ public class AnalyzeDuplicateMojo
             modelDependencies2.add( dep.getManagementKey() );
         }
 
-        //@formatter:off
+        // @formatter:off
         return new LinkedHashSet<String>( 
-          CollectionUtils.disjunction( modelDependencies2, new LinkedHashSet<String>( modelDependencies2 ) ) 
-        );
-        //@formatter:on
+                CollectionUtils.disjunction( modelDependencies2, new LinkedHashSet<String>( modelDependencies2 ) ) );
+        // @formatter:on
     }
 }