diff --git a/src/it/issue-7/green-eggs/pom.xml b/src/it/issue-7/green-eggs/pom.xml new file mode 100644 index 00000000..c215f32c --- /dev/null +++ b/src/it/issue-7/green-eggs/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.codehaus.mojo.extra-enforcer-rules.it + issue-7 + 0.0.0-SNAPSHOT + + + green-eggs + + + + org.slf4j + slf4j-api + 1.7.6 + + + + diff --git a/src/it/issue-7/green-eggs/src/main/resources/placeholder.txt b/src/it/issue-7/green-eggs/src/main/resources/placeholder.txt new file mode 100644 index 00000000..77f18048 --- /dev/null +++ b/src/it/issue-7/green-eggs/src/main/resources/placeholder.txt @@ -0,0 +1 @@ +I would not eat them on a boat. diff --git a/src/it/issue-7/ham/pom.xml b/src/it/issue-7/ham/pom.xml new file mode 100644 index 00000000..921bb636 --- /dev/null +++ b/src/it/issue-7/ham/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.codehaus.mojo.extra-enforcer-rules.it + issue-7 + 0.0.0-SNAPSHOT + + + ham + + + + org.slf4j + slf4j-api + 1.7.2 + + + + diff --git a/src/it/issue-7/ham/src/main/resources/placeholder.txt b/src/it/issue-7/ham/src/main/resources/placeholder.txt new file mode 100644 index 00000000..56f80785 --- /dev/null +++ b/src/it/issue-7/ham/src/main/resources/placeholder.txt @@ -0,0 +1 @@ +I would not eat them with a goat. diff --git a/src/it/issue-7/invoker.properties b/src/it/issue-7/invoker.properties new file mode 100644 index 00000000..b2e5bbdb --- /dev/null +++ b/src/it/issue-7/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = package +invoker.buildResult = success diff --git a/src/it/issue-7/pom.xml b/src/it/issue-7/pom.xml new file mode 100644 index 00000000..f819757a --- /dev/null +++ b/src/it/issue-7/pom.xml @@ -0,0 +1,49 @@ + + 4.0.0 + + org.codehaus.mojo.extra-enforcer-rules.it + issue-7 + 0.0.0-SNAPSHOT + pom + + Multiple versions test + + + green-eggs + ham + sam-i-am + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + @enforcerPluginVersion@ + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + + enforce-rules + validate + + enforce + + + + + + + + + + + + + diff --git a/src/it/issue-7/sam-i-am/pom.xml b/src/it/issue-7/sam-i-am/pom.xml new file mode 100644 index 00000000..f8cea20f --- /dev/null +++ b/src/it/issue-7/sam-i-am/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + + org.codehaus.mojo.extra-enforcer-rules.it + issue-7 + 0.0.0-SNAPSHOT + + + sam-i-am + + + + ${project.groupId} + green-eggs + ${project.version} + + + ${project.groupId} + ham + ${project.version} + + + + diff --git a/src/it/issue-7/sam-i-am/src/main/resources/placeholder.txt b/src/it/issue-7/sam-i-am/src/main/resources/placeholder.txt new file mode 100644 index 00000000..567ae2f1 --- /dev/null +++ b/src/it/issue-7/sam-i-am/src/main/resources/placeholder.txt @@ -0,0 +1 @@ +I do not like green eggs and ham! diff --git a/src/it/mojo-1682/invoker.properties b/src/it/mojo-1682/invoker.properties index 76149456..735140d5 100644 --- a/src/it/mojo-1682/invoker.properties +++ b/src/it/mojo-1682/invoker.properties @@ -1,2 +1,2 @@ -invoker.goals = enforcer:enforce +invoker.goals = enforcer:enforce invoker.buildResult = failure \ No newline at end of file diff --git a/src/it/mojo-1682/pom.xml b/src/it/mojo-1682/pom.xml index 23b1f550..cb91d58e 100644 --- a/src/it/mojo-1682/pom.xml +++ b/src/it/mojo-1682/pom.xml @@ -1,45 +1,47 @@ - - 4.0.0 - - org.codehaus.mojo.extra-enforcer-rules.it - mojo-1682 - 1.0-SNAPSHOT - Transitive test - - - - org.springframework - spring-core - 2.5.6 - - - springframework - spring-core - 1.2.6 - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - @enforcerPluginVersion@ - - - @project.groupId@ - @project.artifactId@ - @project.version@ - - - - - - - - - - - - + + 4.0.0 + + org.codehaus.mojo.extra-enforcer-rules.it + mojo-1682 + 1.0-SNAPSHOT + Transitive test + + + + + org.apache.tomcat + tomcat-catalina + 7.0.61 + + + + org.jboss.spec.javax.security.jacc + jboss-jacc-api_1.4_spec + 1.0.3.Final + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + @enforcerPluginVersion@ + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + + + + + + + + + diff --git a/src/main/java/org/apache/maven/plugins/enforcer/AbstractResolveDependencies.java b/src/main/java/org/apache/maven/plugins/enforcer/AbstractResolveDependencies.java index 005f6041..e6aed3c0 100644 --- a/src/main/java/org/apache/maven/plugins/enforcer/AbstractResolveDependencies.java +++ b/src/main/java/org/apache/maven/plugins/enforcer/AbstractResolveDependencies.java @@ -122,17 +122,20 @@ private Set getAllDescendants( DependencyNode node ) { try { - Artifact artifact = depNode.getArtifact(); - - resolver.resolve( artifact, remoteRepositories, localRepository ); - - children.add( artifact ); - - Set subNodes = getAllDescendants( depNode ); - - if( subNodes != null ) + if ( depNode.getState() == DependencyNode.INCLUDED ) { - children.addAll(subNodes); + Artifact artifact = depNode.getArtifact(); + + resolver.resolve( artifact, remoteRepositories, localRepository ); + + children.add( artifact ); + + Set subNodes = getAllDescendants( depNode ); + + if( subNodes != null ) + { + children.addAll(subNodes); + } } } catch ( ArtifactResolutionException e )