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 14:03:06 UTC

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

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 f9e7062  - Refactored code.
 discard 462ebec  - Fixed JavaDoc. - Removed references which will not being rendered. - Removed unused classes in src/test/java/org/codehaus.* - Removed superfluous @SuppressWarnings
     new 8629058  - Fixed JavaDoc. - Removed references which will not being rendered. - Removed unused classes in src/test/java/org/codehaus.* - Removed superfluous @SuppressWarnings - 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   (f9e7062)
            \
             N -- N -- N   refs/heads/IMPROVED_CODE (8629058)

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-dependency-plugin] 01/01: - Fixed JavaDoc. - Removed references which will not being rendered. - Removed unused classes in src/test/java/org/codehaus.* - Removed superfluous @SuppressWarnings - 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 8629058eb1da666ba6e34cd55358f9915584f14e
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Thu Mar 21 10:14:54 2019 +0100

    - Fixed JavaDoc.
    - Removed references which will not being rendered.
    - Removed unused classes in src/test/java/org/codehaus.*
    - Removed superfluous @SuppressWarnings
    - Refactored code.
---
 .../dependency/PurgeLocalRepositoryMojo.java       |  1 +
 .../dependency/analyze/AbstractAnalyzeMojo.java    |  3 -
 .../dependency/analyze/AnalyzeDuplicateMojo.java   | 70 ++++++++++------------
 .../resolvers/ResolveDependenciesMojo.java         |  1 -
 .../plexus/util/interpolation/Interpolator.java    | 33 ----------
 .../util/interpolation/RegexBasedInterpolator.java | 63 -------------------
 .../plexus/util/interpolation/ValueSource.java     | 33 ----------
 7 files changed, 34 insertions(+), 170 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
index b86b941..ac03641 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
@@ -362,6 +362,7 @@ public class PurgeLocalRepositoryMojo
      * Purges the local repository for the dependencies in the given Maven project.
      *
      * @param theProject Maven project.
+     * @param purgedArtifacts The artifacts that were already purged.
      * @throws MojoFailureException in case of errors during the purge.
      */
     private void purgeLocalRepository( MavenProject theProject, Set<Artifact> purgedArtifacts )
diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
index 0e0f584..5c71b2c 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java
@@ -174,7 +174,6 @@ public abstract class AbstractAnalyzeMojo
      * </p>
      *
      * @since 2.10
-     * @see StrictPatternIncludesArtifactFilter
      */
     @Parameter
     private String[] ignoredDependencies = new String[0];
@@ -194,7 +193,6 @@ public abstract class AbstractAnalyzeMojo
      * </p>
      *
      * @since 2.10
-     * @see StrictPatternIncludesArtifactFilter
      */
     @Parameter
     private String[] ignoredUsedUndeclaredDependencies = new String[0];
@@ -214,7 +212,6 @@ public abstract class AbstractAnalyzeMojo
      * </p>
      *
      * @since 2.10
-     * @see StrictPatternIncludesArtifactFilter
      */
     @Parameter
     private String[] ignoredUnusedDeclaredDependencies = new String[0];
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 e1260d4..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,52 +119,43 @@ 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" );
+                }
             }
         }
     }
 
-    @SuppressWarnings( "unchecked" )
     private Set<String> findDuplicateDependencies( List<Dependency> modelDependencies )
     {
         List<String> modelDependencies2 = new ArrayList<String>();
@@ -167,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
     }
 }
diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
index 86b595c..93d523a 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependenciesMojo.java
@@ -266,7 +266,6 @@ public class ResolveDependenciesMojo
             Object moduleFinderInstance = ofMethod.invoke( null, new Object[] { new java.nio.file.Path[] { path } } );
 
             Method findAllMethod = moduleFinderClass.getMethod( "findAll" );
-            @SuppressWarnings( "unchecked" )
             Set<Object> moduleReferences = (Set<Object>) findAllMethod.invoke( moduleFinderInstance );
 
             // moduleReferences can be empty when referring to target/classes without module-info.class
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java b/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java
deleted file mode 100644
index 81b9195..0000000
--- a/src/test/java/org/codehaus/plexus/util/interpolation/Interpolator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.codehaus.plexus.util.interpolation;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS Interpolator interface. Based on existing RegexBasedInterpolator
- * interface.
- *
- * @author cstamas
- * @deprecated Use plexus-interpolation APIs instead.
- * @version $Id: Interpolator.java 12174 2010-05-16 21:04:35Z rfscholte $
- */
-public interface Interpolator
-    extends org.codehaus.plexus.interpolation.Interpolator
-{
-}
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java b/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java
deleted file mode 100644
index 9e0f6a7..0000000
--- a/src/test/java/org/codehaus/plexus/util/interpolation/RegexBasedInterpolator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.codehaus.plexus.util.interpolation;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.List;
-
-/**
- * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS
- *
- * @version $Id: RegexBasedInterpolator.java 12174 2010-05-16 21:04:35Z rfscholte $
- * @deprecated Use plexus-interpolation APIs instead.
- */
-public class RegexBasedInterpolator
-    extends org.codehaus.plexus.interpolation.RegexBasedInterpolator
-    implements Interpolator
-{
-    public RegexBasedInterpolator()
-    {
-        super();
-    }
-
-    public RegexBasedInterpolator( List valueSources )
-    {
-        super( valueSources );
-    }
-
-    public RegexBasedInterpolator( String startRegex, String endRegex, List valueSources )
-    {
-        super( startRegex, endRegex, valueSources );
-    }
-
-    public RegexBasedInterpolator( String startRegex, String endRegex )
-    {
-        super( startRegex, endRegex );
-    }
-
-    public void addValueSource( ValueSource valueSource )
-    {
-        super.addValueSource( valueSource );
-    }
-
-    public void removeValuesSource( ValueSource valueSource )
-    {
-        super.removeValuesSource( valueSource );
-    }
-}
diff --git a/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java b/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java
deleted file mode 100644
index 05d6bef..0000000
--- a/src/test/java/org/codehaus/plexus/util/interpolation/ValueSource.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.codehaus.plexus.util.interpolation;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * COPIED FROM plexus-utils-1.5.15 TO SATISFY TESTS
- *
- * @author jdcasey
- * @deprecated Use plexus-interpolation APIs instead.
- * @version $Id: ValueSource.java 12174 2010-05-16 21:04:35Z rfscholte $
- */
-public interface ValueSource
-    extends org.codehaus.plexus.interpolation.ValueSource
-{
-
-}