Author: henning
Date: Mon Jan  5 01:37:42 2015
New Revision: 1649454

URL: http://svn.apache.org/r1649454
Log:
[MDEP-476] Add dependency ignores to the analyze-* targets.
    
Allow ignoring of "declared but unused" and "undeclared but used"
dependencies. This is a sorely missed feature especially with
dependencies that can not be detected properly from looking at the
byte code.


Added:
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/
    
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java
   (with props)
    
maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
   (with props)
Modified:
    
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/analyze/AbstractAnalyzeMojo.java
    maven/plugins/trunk/maven-dependency-plugin/src/site/apt/index.apt.vm
    maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = clean 
${project.groupId}:${project.artifactId}:${project.version}:analyze

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency:analyze with ignoreDependencies
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <configuration>
+           <verbose>true</verbose>
+           <failOnWarning>true</failOnWarning>
+           <ignoredDependencies>
+             
<ignoredDependency>org.apache.maven:maven-project</ignoredDependency>
+             
<ignoredDependency>org.apache.maven:maven-model</ignoredDependency>
+           </ignoredDependencies>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.maven.model.Model;
+
+public class Main
+{
+    public Model model = null;
+}

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-dependency/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:keywords = Id Author Date Revision

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = clean 
${project.groupId}:${project.artifactId}:${project.version}:analyze

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency:analyze with ignoreUnusedDeclaredDependencies
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <configuration>
+           <verbose>true</verbose>
+           <failOnWarning>true</failOnWarning>
+           <ignoredUnusedDeclaredDependencies>
+             
<ignoredUnusedDeclaredDependency>org.apache.maven:maven-project</ignoredUnusedDeclaredDependency>
+           </ignoredUnusedDeclaredDependencies>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+public class Main
+{
+}

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-unused-declared-dependency/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = clean 
${project.groupId}:${project.artifactId}:${project.version}:analyze

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.dependency</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test</name>
+  <description>
+    Test dependency:analyze with ignoreUsedUndeclaredDependencies
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>2.0.6</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <configuration>
+           <verbose>true</verbose>
+           <failOnWarning>true</failOnWarning>
+           <ignoredUsedUndeclaredDependencies>
+             
<ignoreUsedUndeclaredDependency>org.apache.maven:maven-model</ignoreUsedUndeclaredDependency>
+           </ignoredUsedUndeclaredDependencies>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,27 @@
+/*
+ * 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 org.apache.maven.Maven;
+import org.apache.maven.model.Model;
+
+public class Main
+{
+    public Maven maven = null;
+    public Model model = null;
+}

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/analyze-ignore-used-undeclared-dependency/src/main/java/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/analyze/AbstractAnalyzeMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/analyze/AbstractAnalyzeMojo.java?rev=1649454&r1=1649453&r2=1649454&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/analyze/AbstractAnalyzeMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/analyze/AbstractAnalyzeMojo.java
 Mon Jan  5 01:37:42 2015
@@ -21,15 +21,22 @@ package org.apache.maven.plugin.dependen
 
 import java.io.File;
 import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
+import 
org.apache.maven.shared.artifact.filter.StrictPatternExcludesArtifactFilter;
 import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
 import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
 import 
org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
@@ -140,7 +147,7 @@ public abstract class AbstractAnalyzeMoj
     /**
      * Force dependencies as used, to override incomplete result caused by 
bytecode-level analysis.
      * Dependency format is <code>groupId:artifactId</code>.
-     * 
+     *
      * @since 2.6
      */
     @Parameter
@@ -154,6 +161,72 @@ public abstract class AbstractAnalyzeMoj
     @Parameter( property = "mdep.analyze.skip", defaultValue = "false" )
     private boolean skip;
 
+    /**
+     * 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:
+     *
+     * <pre>
+     * [groupId]:[artifactId]:[type]:[version]
+     * </pre>
+     *
+     * where each pattern segment is optional and supports full and partial 
<code>*</code> wildcards. An empty pattern
+     * segment is treated as an implicit wildcard.
+     * *
+     * <p>For example, <code>org.apache.*</code> will match all artifacts 
whose group id starts with
+     * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all 
snapshot artifacts.</p>
+     *
+     * @since 2.10
+     * @see StrictPatternIncludesArtifactFilter
+     */
+    @Parameter
+    private String [] ignoredDependencies = new String[0];
+
+    /**
+     * List of dependencies that will be ignored if they are used but 
undeclared.
+     *
+     * The filter syntax is:
+     *
+     * <pre>
+     * [groupId]:[artifactId]:[type]:[version]
+     * </pre>
+     *
+     * where each pattern segment is optional and supports full and partial 
<code>*</code> wildcards. An empty pattern
+     * segment is treated as an implicit wildcard.
+     * *
+     * <p>For example, <code>org.apache.*</code> will match all artifacts 
whose group id starts with
+     * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all 
snapshot artifacts.</p>
+     *
+     * @since 2.10
+     * @see StrictPatternIncludesArtifactFilter
+     */
+    @Parameter
+    private String [] ignoredUsedUndeclaredDependencies = new String[0];
+
+    /**
+     * List of dependencies that will be ignored if they are declared but 
unused.
+     *
+     * The filter syntax is:
+     *
+     * <pre>
+     * [groupId]:[artifactId]:[type]:[version]
+     * </pre>
+     *
+     * where each pattern segment is optional and supports full and partial 
<code>*</code> wildcards. An empty pattern
+     * segment is treated as an implicit wildcard.
+     * *
+     * <p>For example, <code>org.apache.*</code> will match all artifacts 
whose group id starts with
+     * <code>org.apache.</code>, and <code>:::*-SNAPSHOT</code> will match all 
snapshot artifacts.</p>
+     *
+     * @since 2.10
+     * @see StrictPatternIncludesArtifactFilter
+     */
+    @Parameter
+    private String [] ignoredUnusedDeclaredDependencies = new String[0];
+
+
     // Mojo methods -----------------------------------------------------------
 
     /*
@@ -250,21 +323,29 @@ public abstract class AbstractAnalyzeMoj
             analysis = analysis.ignoreNonCompile();
         }
 
-        Set<Artifact> usedDeclared = analysis.getUsedDeclaredArtifacts();
-        Set<Artifact> usedUndeclared = analysis.getUsedUndeclaredArtifacts();
-        Set<Artifact> unusedDeclared = analysis.getUnusedDeclaredArtifacts();
+        Set<Artifact> usedDeclared = new HashSet<Artifact>( 
analysis.getUsedDeclaredArtifacts() );
+        Set<Artifact> usedUndeclared = new HashSet<Artifact>( 
analysis.getUsedUndeclaredArtifacts() );
+        Set<Artifact> unusedDeclared = new HashSet<Artifact>( 
analysis.getUnusedDeclaredArtifacts() );
+
+        Set<Artifact> ignoredUsedUndeclared = new HashSet<Artifact>();
+        Set<Artifact> ignoredUnusedDeclared = new HashSet<Artifact>();
+
+        ignoredUsedUndeclared.addAll( filterDependencies( usedUndeclared, 
ignoredDependencies ) );
+        ignoredUsedUndeclared.addAll( filterDependencies( usedUndeclared, 
ignoredUsedUndeclaredDependencies ) );
+
+        ignoredUnusedDeclared.addAll( filterDependencies( unusedDeclared, 
ignoredDependencies ) );
+        ignoredUnusedDeclared.addAll( filterDependencies( unusedDeclared, 
ignoredUnusedDeclaredDependencies ) );
+
+        boolean reported = false;
+        boolean warning = false;
 
-        if ( ( !verbose || usedDeclared.isEmpty() ) && 
usedUndeclared.isEmpty() && unusedDeclared.isEmpty() )
-        {
-            getLog().info( "No dependency problems found" );
-            return false;
-        }
 
         if ( verbose && !usedDeclared.isEmpty() )
         {
             getLog().info( "Used declared dependencies found:" );
 
             logArtifacts( analysis.getUsedDeclaredArtifacts(), false );
+            reported = true;
         }
 
         if ( !usedUndeclared.isEmpty() )
@@ -272,6 +353,8 @@ public abstract class AbstractAnalyzeMoj
             getLog().warn( "Used undeclared dependencies found:" );
 
             logArtifacts( usedUndeclared, true );
+            reported = true;
+            warning = true;
         }
 
         if ( !unusedDeclared.isEmpty() )
@@ -279,6 +362,24 @@ public abstract class AbstractAnalyzeMoj
             getLog().warn( "Unused declared dependencies found:" );
 
             logArtifacts( unusedDeclared, true );
+            reported = true;
+            warning = true;
+        }
+
+        if ( verbose && !ignoredUsedUndeclared.isEmpty() )
+        {
+            getLog().info( "Ignored used undeclared dependencies:" );
+
+            logArtifacts( ignoredUsedUndeclared, false );
+            reported = true;
+        }
+
+        if ( verbose && !ignoredUnusedDeclared.isEmpty() )
+        {
+            getLog().info( "Ignored unused declared dependencies:" );
+
+            logArtifacts( ignoredUnusedDeclared, false );
+            reported = true;
         }
 
         if ( outputXML )
@@ -291,7 +392,12 @@ public abstract class AbstractAnalyzeMoj
             writeScriptableOutput( usedUndeclared );
         }
 
-        return !usedUndeclared.isEmpty() || !unusedDeclared.isEmpty();
+        if ( !reported )
+        {
+            getLog().info( "No dependency problems found" );
+        }
+
+        return warning;
     }
 
     private void logArtifacts( Set<Artifact> artifacts, boolean warn )
@@ -385,4 +491,23 @@ public abstract class AbstractAnalyzeMoj
             getLog().info( "\n" + buf );
         }
     }
+
+    private List<Artifact> filterDependencies( Set<Artifact> artifacts, 
String[] excludes )
+        throws MojoExecutionException
+    {
+        ArtifactFilter filter = new StrictPatternExcludesArtifactFilter( 
Arrays.asList( excludes ) );
+        List<Artifact> result = new ArrayList<Artifact>();
+
+        for ( Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
+        {
+            Artifact artifact = it.next();
+            if ( !filter.include( artifact ) )
+            {
+                it.remove();
+                result.add( artifact );
+            }
+        }
+
+        return result;
+    }
 }

Added: 
maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm?rev=1649454&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
 (added)
+++ 
maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
 Mon Jan  5 01:37:42 2015
@@ -0,0 +1,93 @@
+~~ 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.    
+ 
+  ------
+  Exclude dependencies from dependency analysis
+  ------
+  Henning Schmiedehausen
+  ------
+  Jan 2015
+  ------
+
+Exclude dependencies from dependency analysis
+
+  A project's dependencies can be analyzed as part of the build process by 
binding the <<<dependency:analyze-only>>>
+  goal to the lifecycle.  By default, the analysis will be performed during 
the <<<verify>>> lifecycle phase.  
+
+  In rare cases it is possible to have dependencies that are
+  legitimate on the classpath but cause either "Declared but unused"
+  or "Undeclared but used" warnings. The most common case is with jars
+  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:
+
++---+
+<project>
+  ...
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>analyze</id>
+            <goals>
+              <goal>analyze-only</goal>
+            </goals>
+            <configuration>
+              <failOnWarning>true</failOnWarning>
+
+              <!-- ignore jsr305 for both "used but undeclared" and "declared 
but unused" -->
+              <ignoredDependencies>
+                
<ignoredDependency>com.google.code.findbugs:jsr305</ignoredDependency>
+              </ignoredDependencies>
+
+              <!-- ignore annotations for "used but undeclared" warnings -->
+              <ignoredUsedUndeclaredDependencies>
+                
<ignoredUsedUndeclaredDependency>com.google.code.findbugs:annotations</ignoredUsedUndeclaredDependency>
+              </ignoredUsedUndeclaredDependencies>
+
+              <!-- ignore annotations for "unused but declared" warnings -->
+              <ignoredUnusedDeclaredDependencies>
+                
<ignoredUnusedDeclaredDependency>com.google.code.findbugs:annotations</ignoredUnusedDeclaredDependency>
+              </ignoredUnusedDeclaredDependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  ...
+</project>
++---+
+
+  Note that the <<<dependency:analyze-only>>> goal is used in preference to 
<<<dependency:analyze>>> since it doesn't
+  force a further compilation of the project, but uses the compiled classes 
produced from the earlier
+  <<<test-compile>>> phase in the lifecycle.
+
+  The project's dependencies will then be automatically analyzed during the 
<<<verify>>> lifecycle phase, which can be
+  executed explicitly as follows:
+       
++---+
+mvn verify
++---+

Propchange: 
maven/plugins/trunk/maven-dependency-plugin/src/site/apt/examples/exclude-dependencies-from-dependency-analysis.apt.vm
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/apt/index.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/apt/index.apt.vm?rev=1649454&r1=1649453&r2=1649454&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/site/apt/index.apt.vm 
(original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/site/apt/index.apt.vm Mon 
Jan  5 01:37:42 2015
@@ -134,6 +134,8 @@ ${project.name}
 
   * 
{{{./examples/failing-the-build-on-dependency-analysis-warnings.html}Failing 
the Build on Dependency Analysis Warnings}}
 
+  * {{{./examples/exclude-dependencies-from-dependency-analysis.html}Exclude 
Dependencies from Dependency Analysis}}
+
   * {{{./examples/filtering-the-dependency-tree.html}Filtering the Dependency 
Tree}}
 
   * {{{./examples/resolving-conflicts-using-the-dependency-tree.html}Resolving 
Conflicts Using the Dependency Tree}}

Modified: maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml?rev=1649454&r1=1649453&r2=1649454&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/site/site.xml Mon Jan  5 
01:37:42 2015
@@ -40,6 +40,7 @@ under the License.
       <item name="Unpacking the project dependencies" 
href="examples/unpacking-project-dependencies.html"/>
       <item name="Using project dependencies' sources" 
href="examples/using-dependencies-sources.html"/>
       <item name="Failing the build on dependency analysis warnings" 
href="examples/failing-the-build-on-dependency-analysis-warnings.html"/>
+      <item name="Exclude Dependencies from Dependency Analysis" 
href="examples/exclude-dependencies-from-dependency-analysis.html"/>
       <item name="Filtering the dependency tree" 
href="examples/filtering-the-dependency-tree.html"/>
       <item name="Resolving conflicts using the dependency tree" 
href="examples/resolving-conflicts-using-the-dependency-tree.html"/>
       <item name="Purging local repository dependencies" 
href="examples/purging-local-repository.html"/>


Reply via email to