This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch MRESOLVER-9 in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
commit ca0d638510beff4e2fea3d8004746a46a55781e9 Author: Christian Schulte <c...@schulte.it> AuthorDate: Sat Mar 11 22:39:20 2017 +0100 [MRESOLVER-9] DefaultDependencyCollector does not correctly handle dependency management --- .../internal/impl/collect/DefaultDependencyCollector.java | 10 +++++----- .../internal/impl/collect/DefaultDependencyCollectorTest.java | 6 +----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java index 9d37435..52fda64 100644 --- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java +++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java @@ -433,16 +433,16 @@ public class DefaultDependencyCollector Args args = context.getArgs(); Results results = context.getResults(); - if ( context.getDepSelector() != null && !context.getDepSelector().selectDependency( dc.origDependency ) ) - { - return null; - } - PremanagedDependency preManaged = PremanagedDependency.create( context.getDepManager(), dc.origDependency, dc.disableVersionManagement, args.premanagedState ); Dependency dependency = preManaged.managedDependency; + if ( context.getDepSelector() != null && !context.getDepSelector().selectDependency( dependency ) ) + { + return null; + } + boolean noDescriptor = isLackingDescriptor( dependency.getArtifact() ); boolean traverse = !noDescriptor diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectorTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectorTest.java index 88ced9f..d4a0ee0 100644 --- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectorTest.java +++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectorTest.java @@ -571,10 +571,6 @@ public class DefaultDependencyCollectorTest /** * Tests that scope based dependency selection happens before dependency management. - * <p> - * This is not really correct (see MRESOLVER-9), but there are a number of tests - * in the Maven and Maven Integration Testing projects that currently rely on this - * behaviour. */ @Test public void testSelectionBeforeManagement() @@ -604,7 +600,7 @@ public class DefaultDependencyCollectorTest // With proper dependency management, the test scope of aid3 would // be managed to compile, and we would get another child. // Currently, the dependency gets filtered by ScopeDependencyManager. - assertEquals( 0, childLevel1.getChildren().size() ); + assertEquals( 1, childLevel1.getChildren().size() ); } static class TestDependencyManager