You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/02/13 23:15:39 UTC

[maven-dependency-plugin] 01/01: [MDEP-789] Improve documentation of analyze - Non-test scoped

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

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

commit 1e71306081c94a03b3eccda22d63b44316ffb5ad
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Feb 14 00:14:57 2022 +0100

    [MDEP-789] Improve documentation of analyze - Non-test scoped
---
 .../plugins/dependency/analyze/AbstractAnalyzeMojo.java  |  4 +++-
 .../exclude-dependencies-from-dependency-analysis.apt.vm | 16 +++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

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 23c58f2..033f7af 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
@@ -98,6 +98,8 @@ public abstract class AbstractAnalyzeMojo
 
     /**
      * Ignore Runtime/Provided/Test/System scopes for unused dependency analysis.
+     *
+     * <code><b>Non-test scoped</b></code> list will be not affected.
      */
     @Parameter( property = "ignoreNonCompile", defaultValue = "false" )
     private boolean ignoreNonCompile;
@@ -167,7 +169,7 @@ public abstract class AbstractAnalyzeMojo
 
     /**
      * List of dependencies that will be ignored. Any dependency on this list will be excluded from the "declared but
-     * unused" and the "used but undeclared" list. The filter syntax is:
+     * unused", the "used but undeclared" and the "non-test scoped" list. The filter syntax is:
      *
      * <pre>
      * [groupId]:[artifactId]:[type]:[version]
diff --git a/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm b/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
index fa04f07..604dbb7 100644
--- a/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
+++ b/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
@@ -34,10 +34,11 @@ Exclude dependencies from dependency analysis
   that contain annotations and the byte code analysis is unable to
   determine whether a jar is actually required or not.
 
-  The plugin can then be configured to ignore these dependencies in
-  either "declared but unused" or "undeclared but used" case or in
-  both simultaneously.  See the following POM configuration for an
-  example:
+  The plugin can then be configured to ignore dependencies in
+  "declared but unused", "undeclared but used" and "non-test scoped"
+  in selected list or in all simultaneously.
+
+  See the following POM configuration for an example:
 
 +---+
 <project>
@@ -57,7 +58,7 @@ Exclude dependencies from dependency analysis
             <configuration>
               <failOnWarning>true</failOnWarning>
 
-              <!-- ignore jsr305 for both "used but undeclared" and "declared but unused" -->
+              <!-- ignore jsr305 for "used but undeclared", "declared but unused" and "non-test scoped" -->
               <ignoredDependencies>
                 <ignoredDependency>com.google.code.findbugs:jsr305</ignoredDependency>
               </ignoredDependencies>
@@ -71,6 +72,11 @@ Exclude dependencies from dependency analysis
               <ignoredUnusedDeclaredDependencies>
                 <ignoredUnusedDeclaredDependency>com.google.code.findbugs:annotations</ignoredUnusedDeclaredDependency>
               </ignoredUnusedDeclaredDependencies>
+
+              <!-- ignore annotations for "non-test scoped" warnings -->
+              <ignoredNonTestScopedDependencies>
+                <ignoredNonTestScopedDependency>com.google.code.findbugs:annotations</ignoredNonTestScopedDependency>
+              </ignoredNonTestScopedDependencies>
             </configuration>
           </execution>
         </executions>