diff --git a/src/it/mrm/repository/hadoop-client-1.0.0-test.pom b/src/it/mrm/repository/hadoop-client-1.0.0-test.pom new file mode 100644 index 000000000..601ba87a3 --- /dev/null +++ b/src/it/mrm/repository/hadoop-client-1.0.0-test.pom @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.maven.its.dependency + hadoop-project + 1.0.0-test + + + hadoop-client + + + + org.apache.maven.its.dependency + hadoop-common + + + org.slf4j + slf4j-log4j12 + + + + + + diff --git a/src/it/mrm/repository/hadoop-common-1.0.0-test.pom b/src/it/mrm/repository/hadoop-common-1.0.0-test.pom new file mode 100644 index 000000000..552b232e6 --- /dev/null +++ b/src/it/mrm/repository/hadoop-common-1.0.0-test.pom @@ -0,0 +1,35 @@ + + + + 4.0.0 + + org.apache.maven.its.dependency + hadoop-project + 1.0.0-test + + + hadoop-common + + + + org.slf4j + slf4j-reload4j + + + + diff --git a/src/it/mrm/repository/hadoop-project-1.0.0-test.pom b/src/it/mrm/repository/hadoop-project-1.0.0-test.pom new file mode 100644 index 000000000..cc3adc0d6 --- /dev/null +++ b/src/it/mrm/repository/hadoop-project-1.0.0-test.pom @@ -0,0 +1,50 @@ + + + + 4.0.0 + org.apache.maven.its.dependency + hadoop-project + 1.0.0-test + Apache Hadoop Project POM + Apache Hadoop Project POM + pom + 2008 + + + + + org.apache.maven.its.dependency + hadoop-common + 1.0.0-test + + + org.slf4j + slf4j-reload4j + + + + + + org.slf4j + slf4j-reload4j + 1.7.36 + + + + + diff --git a/src/it/projects/analyze-exclusions-gh-1598/invoker.properties b/src/it/projects/analyze-exclusions-gh-1598/invoker.properties new file mode 100644 index 000000000..70c436ffc --- /dev/null +++ b/src/it/projects/analyze-exclusions-gh-1598/invoker.properties @@ -0,0 +1,19 @@ +# 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 = ${project.groupId}:${project.artifactId}:${project.version}:analyze-exclusions -Dmdep.exclusion.fail=true +invoker.maven.version = !4.0.0+ \ No newline at end of file diff --git a/src/it/projects/analyze-exclusions-gh-1598/pom.xml b/src/it/projects/analyze-exclusions-gh-1598/pom.xml new file mode 100644 index 000000000..c92a2bf23 --- /dev/null +++ b/src/it/projects/analyze-exclusions-gh-1598/pom.xml @@ -0,0 +1,66 @@ + + + + + 4.0.0 + + org.apache.maven.its.dependency + test + 1.0-SNAPSHOT + + + Test dependency:analyze-exclusion with exclude which is also excluded by dependencyManagement in transitive dependency + https://central.sonatype.com/artifact/org.apache.hadoop/hadoop-project/3.4.3 + Should be ok with Maven 3.x + + + https://github.com/apache/maven-dependency-plugin/issues/1598 + + + UTF-8 + + + + + org.apache.maven.its.dependency + hadoop-client + 1.0.0-test + + + org.slf4j + slf4j-reload4j + + + + + + + + + + maven-dependency-plugin + @project.version@ + + + + + diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/ResolverUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/ResolverUtil.java index e135b47a3..8ff22350f 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/utils/ResolverUtil.java +++ b/src/main/java/org/apache/maven/plugins/dependency/utils/ResolverUtil.java @@ -82,15 +82,17 @@ public ResolverUtil(RepositorySystem repositorySystem, Provider ma /** * Collects the transitive dependencies. * - * @param root a root dependency for collections - * @return a resolved dependencies collections + * @param dependency a dependency for collections + * @return a resolved dependencies collection */ - public Collection collectDependencies(Dependency root) throws DependencyCollectionException { + public Collection collectDependencies(Dependency dependency) throws DependencyCollectionException { MavenSession session = mavenSessionProvider.get(); CollectRequest request = - new CollectRequest(root, session.getCurrentProject().getRemoteProjectRepositories()); + new CollectRequest(null, session.getCurrentProject().getRemoteProjectRepositories()); + request.addDependency(dependency); + CollectResult result = repositorySystem.collectDependencies(session.getRepositorySession(), request); PreorderNodeListGenerator nodeListGenerator = new PreorderNodeListGenerator();