maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [maven-resolver] 01/01: [MRESOLVER-92] Revert MRESOLVER-7
Date Mon, 12 Aug 2019 09:52:12 GMT
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch pre-MRESOLVER-92
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 4e5d3cf40075f2c90cab3fd1be15dea6be5ffdfb
Author: tibordigana <tibordigana@apache.org>
AuthorDate: Sun Aug 11 14:39:53 2019 +0200

    [MRESOLVER-92] Revert MRESOLVER-7
---
 .../eclipse/aether/internal/impl/collect/Args.java |  70 --
 .../aether/internal/impl/collect/DataPool.java     | 112 ++-
 .../DefaultDependencyCollectionContext.java        | 178 +----
 .../impl/collect/DefaultDependencyCollector.java   | 880 +++++++++++++--------
 .../impl/collect/DependencyCollectionUtils.java    | 173 ----
 .../internal/impl/collect/DependencyContext.java   |  74 --
 .../impl/collect/PremanagedDependency.java         | 149 ----
 .../aether/internal/impl/collect/Results.java      |  84 --
 .../aether/internal/impl/collect/DataPoolTest.java |  19 +-
 .../collect/DefaultDependencyCollectorTest.java    |  39 -
 .../artifact-descriptions/gid3_aid1_1.ini          |   7 -
 .../artifact-descriptions/gid3_aid2_1.ini          |   2 -
 .../artifact-descriptions/gid3_aid3_1.ini          |   2 -
 .../artifact-descriptions/gid3_aid3_2.ini          |   2 -
 .../aether/util/concurrency/FutureResult.java      |  69 --
 15 files changed, 604 insertions(+), 1256 deletions(-)

diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Args.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Args.java
deleted file mode 100644
index e2c1229..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Args.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.aether.internal.impl.collect;
-
-/*
- * 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 java.util.concurrent.ExecutorService;
-
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.collection.CollectRequest;
-import org.eclipse.aether.util.ConfigUtils;
-import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
-
-class Args
-{
-
-    final RepositorySystemSession session;
-
-    final boolean ignoreRepos;
-
-    final boolean premanagedState;
-
-    final RequestTrace trace;
-
-    final DataPool pool;
-
-    final NodeStack nodes;
-
-    final DefaultDependencyCollectionContext collectionContext;
-
-    final DefaultVersionFilterContext versionContext;
-
-    final CollectRequest request;
-
-    final ExecutorService executor;
-
-    @SuppressWarnings( "checkstyle:parameternumber" )
-    Args( RepositorySystemSession session, RequestTrace trace, DataPool pool, NodeStack nodes,
-          DefaultDependencyCollectionContext collectionContext, DefaultVersionFilterContext versionContext,
-          CollectRequest request, ExecutorService executor )
-    {
-        this.session = session;
-        this.request = request;
-        this.ignoreRepos = session.isIgnoreArtifactDescriptorRepositories();
-        this.premanagedState = ConfigUtils.getBoolean( session, false, DependencyManagerUtils.CONFIG_PROP_VERBOSE );
-        this.trace = trace;
-        this.pool = pool;
-        this.nodes = nodes;
-        this.collectionContext = collectionContext;
-        this.versionContext = versionContext;
-        this.executor = executor;
-    }
-
-}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java
index 10e9ab6..41b5703 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DataPool.java
@@ -19,16 +19,13 @@ package org.eclipse.aether.internal.impl.collect;
  * under the License.
  */
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.WeakHashMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
 
 import org.eclipse.aether.RepositoryCache;
 import org.eclipse.aether.RepositorySystemSession;
@@ -46,7 +43,6 @@ import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
 import org.eclipse.aether.resolution.ArtifactDescriptorResult;
 import org.eclipse.aether.resolution.VersionRangeRequest;
 import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.util.concurrency.FutureResult;
 import org.eclipse.aether.version.Version;
 import org.eclipse.aether.version.VersionConstraint;
 
@@ -61,8 +57,8 @@ final class DataPool
 
     private static final String DESCRIPTORS = DataPool.class.getName() + "$Descriptors";
 
-    public static final Future<ArtifactDescriptorResult> NO_DESCRIPTOR =
-        new FutureResult<>( new ArtifactDescriptorResult( new ArtifactDescriptorRequest() ) );
+    static final ArtifactDescriptorResult NO_DESCRIPTOR =
+        new ArtifactDescriptorResult( new ArtifactDescriptorRequest() );
 
     private ObjectPool<Artifact> artifacts;
 
@@ -124,12 +120,12 @@ final class DataPool
         return dependencies.intern( dependency );
     }
 
-    public Object toKey( ArtifactDescriptorRequest request )
+    Object toKey( ArtifactDescriptorRequest request )
     {
         return request.getArtifact();
     }
 
-    public Future<ArtifactDescriptorResult> getDescriptor( Object key, ArtifactDescriptorRequest request )
+    ArtifactDescriptorResult getDescriptor( Object key, ArtifactDescriptorRequest request )
     {
         Descriptor descriptor = descriptors.get( key );
         if ( descriptor != null )
@@ -139,22 +135,22 @@ final class DataPool
         return null;
     }
 
-    public void putDescriptor( Object key, Future<ArtifactDescriptorResult> futureResult )
+    void putDescriptor( Object key, ArtifactDescriptorResult result )
     {
-        descriptors.put( key, new GoodDescriptor( futureResult ) );
+        descriptors.put( key, new GoodDescriptor( result ) );
     }
 
-    public void putDescriptor( Object key, ArtifactDescriptorException exception )
+    void putDescriptor( Object key, ArtifactDescriptorException e )
     {
         descriptors.put( key, BadDescriptor.INSTANCE );
     }
 
-    public Object toKey( VersionRangeRequest request )
+    Object toKey( VersionRangeRequest request )
     {
         return new ConstraintKey( request );
     }
 
-    public VersionRangeResult getConstraint( Object key, VersionRangeRequest request )
+    VersionRangeResult getConstraint( Object key, VersionRangeRequest request )
     {
         Constraint constraint = constraints.get( key );
         if ( constraint != null )
@@ -164,15 +160,15 @@ final class DataPool
         return null;
     }
 
-    public void putConstraint( Object key, VersionRangeResult result )
+    void putConstraint( Object key, VersionRangeResult result )
     {
         constraints.put( key, new Constraint( result ) );
     }
 
-    public Object toKey( Artifact artifact, DefaultDependencyCollectionContext context )
+    public Object toKey( Artifact artifact, List<RemoteRepository> repositories, DependencySelector selector,
+                         DependencyManager manager, DependencyTraverser traverser, VersionFilter filter )
     {
-        return new GraphKey( artifact, context.getRepositories(), context.getDepSelector(),
-                             context.getDepManager(), context.getDepTraverser(), context.getVerFilter() );
+        return new GraphKey( artifact, repositories, selector, manager, traverser, filter );
     }
 
     public List<DependencyNode> getChildren( Object key )
@@ -187,78 +183,64 @@ final class DataPool
 
     abstract static class Descriptor
     {
-        public abstract Future<ArtifactDescriptorResult> toResult( ArtifactDescriptorRequest request );
+
+        public abstract ArtifactDescriptorResult toResult( ArtifactDescriptorRequest request );
+
     }
 
     static final class GoodDescriptor
         extends Descriptor
     {
-        Future<ArtifactDescriptorResult> futureResult;
 
-        GoodDescriptor( Future<ArtifactDescriptorResult> futureResult )
-        {
-            this.futureResult = futureResult;
-        }
+        final Artifact artifact;
 
-        public Future<ArtifactDescriptorResult> toResult( final ArtifactDescriptorRequest request )
-        {
-            return new Future<ArtifactDescriptorResult>()
-            {
-                public boolean cancel( boolean mayInterruptIfRunning )
-                {
-                    return futureResult.cancel( mayInterruptIfRunning );
-                }
+        final List<Artifact> relocations;
 
-                public boolean isCancelled()
-                {
-                    return futureResult.isCancelled();
-                }
+        final Collection<Artifact> aliases;
 
-                public boolean isDone()
-                {
-                    return futureResult.isDone();
-                }
+        final List<RemoteRepository> repositories;
 
-                public ArtifactDescriptorResult get()
-                    throws InterruptedException, ExecutionException
-                {
-                    ArtifactDescriptorResult result = futureResult.get();
-                    return wrap( request, result );
-                }
-                public ArtifactDescriptorResult get( long timeout, TimeUnit unit )
-                    throws InterruptedException, ExecutionException, TimeoutException
-                {
-                    ArtifactDescriptorResult result = futureResult.get( timeout, unit );
-                    return wrap( request, result );
-                }
-            };
+        final List<Dependency> dependencies;
+
+        final List<Dependency> managedDependencies;
+
+        GoodDescriptor( ArtifactDescriptorResult result )
+        {
+            artifact = result.getArtifact();
+            relocations = result.getRelocations();
+            aliases = result.getAliases();
+            dependencies = result.getDependencies();
+            managedDependencies = result.getManagedDependencies();
+            repositories = result.getRepositories();
         }
 
-        private ArtifactDescriptorResult wrap( ArtifactDescriptorRequest request, ArtifactDescriptorResult result )
+        public ArtifactDescriptorResult toResult( ArtifactDescriptorRequest request )
         {
-            ArtifactDescriptorResult wrapped = new ArtifactDescriptorResult( request );
-            wrapped.setArtifact( result.getArtifact() );
-            wrapped.setRelocations( result.getRelocations() );
-            wrapped.setAliases( result.getAliases() );
-            wrapped.setDependencies( result.getDependencies() );
-            wrapped.setManagedDependencies( result.getManagedDependencies() );
-            wrapped.setRepositories( result.getRepositories() );
-            return wrapped;
+            ArtifactDescriptorResult result = new ArtifactDescriptorResult( request );
+            result.setArtifact( artifact );
+            result.setRelocations( relocations );
+            result.setAliases( aliases );
+            result.setDependencies( dependencies );
+            result.setManagedDependencies( managedDependencies );
+            result.setRepositories( repositories );
+            return result;
         }
+
     }
 
     static final class BadDescriptor
         extends Descriptor
     {
+
         static final BadDescriptor INSTANCE = new BadDescriptor();
 
-        public Future<ArtifactDescriptorResult> toResult( ArtifactDescriptorRequest request )
+        public ArtifactDescriptorResult toResult( ArtifactDescriptorRequest request )
         {
             return NO_DESCRIPTOR;
         }
     }
 
-    static final class Constraint
+    private static final class Constraint
     {
         final VersionRepo[] repositories;
 
@@ -276,7 +258,7 @@ final class DataPool
             }
         }
 
-        public VersionRangeResult toResult( VersionRangeRequest request )
+        VersionRangeResult toResult( VersionRangeRequest request )
         {
             VersionRangeResult result = new VersionRangeResult( request );
             for ( VersionRepo vr : repositories )
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectionContext.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectionContext.java
index 6ea858b..3bf4fe1 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectionContext.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollectionContext.java
@@ -22,22 +22,14 @@ package org.eclipse.aether.internal.impl.collect;
 import java.util.List;
 
 import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.RequestTrace;
 import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.collection.CollectResult;
 import org.eclipse.aether.collection.DependencyCollectionContext;
-import org.eclipse.aether.collection.DependencyManager;
-import org.eclipse.aether.collection.DependencySelector;
-import org.eclipse.aether.collection.DependencyTraverser;
-import org.eclipse.aether.collection.VersionFilter;
 import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.version.Version;
 
 /**
  * @see DefaultDependencyCollector
  */
-class DefaultDependencyCollectionContext
+final class DefaultDependencyCollectionContext
     implements DependencyCollectionContext
 {
 
@@ -48,31 +40,9 @@ class DefaultDependencyCollectionContext
     private Dependency dependency;
 
     private List<Dependency> managedDependencies;
-    private CollectResult collectResult;
-
-    private RequestTrace trace;
-
-    private Args args;
-
-    private Results results;
-
-    private List<Dependency> dependencies;
-
-    private List<RemoteRepository> repositories;
-
-    private DependencySelector depSelector;
-
-    private DependencyManager depManager;
-
-    private DependencyTraverser depTraverser;
-
-    private VersionFilter verFilter;
-
-    private Version version;
-
 
     DefaultDependencyCollectionContext( RepositorySystemSession session, Artifact artifact,
-                                        Dependency dependency, List<Dependency> managedDependencies )
+                                               Dependency dependency, List<Dependency> managedDependencies )
     {
         this.session = session;
         this.artifact = ( dependency != null ) ? dependency.getArtifact() : artifact;
@@ -80,34 +50,6 @@ class DefaultDependencyCollectionContext
         this.managedDependencies = managedDependencies;
     }
 
-    public void prepareDescent()
-    {
-        DependencySelector dependencySelector = session.getDependencySelector();
-        DependencyManager dependencyManager = session.getDependencyManager();
-        VersionFilter versionFilter = session.getVersionFilter();
-        setDepSelector( dependencySelector != null ? dependencySelector.deriveChildSelector( this ) : null );
-        setDepManager( dependencyManager != null ? dependencyManager.deriveChildManager( this ) : null );
-        setDepTraverser( depTraverser != null ? depTraverser.deriveChildTraverser( this ) : null );
-        setVerFilter( versionFilter != null ? versionFilter.deriveChildFilter( this ) : null );
-
-    }
-
-    public DefaultDependencyCollectionContext createChildContext()
-    {
-        DefaultDependencyCollectionContext childContext =
-                        new DefaultDependencyCollectionContext( getSession(), getArtifact(),
-                                                                getDependency(), getManagedDependencies() );
-        childContext.depSelector =
-            getDepSelector() != null ? getDepSelector().deriveChildSelector( this ) : null;
-        childContext.depManager =
-            getDepManager() != null ? getDepManager().deriveChildManager( this ) : null;
-        childContext.depTraverser =
-            getDepTraverser() != null ? getDepTraverser().deriveChildTraverser( this ) : null;
-        childContext.verFilter =
-            getVerFilter() != null ? getVerFilter().deriveChildFilter( this ) : null;
-        return childContext;
-    }
-
     public RepositorySystemSession getSession()
     {
         return session;
@@ -128,127 +70,13 @@ class DefaultDependencyCollectionContext
         return managedDependencies;
     }
 
-    public CollectResult getCollectResult()
-    {
-        return collectResult;
-    }
-
-    public void setCollectResult( CollectResult collectResult )
-    {
-        this.collectResult = collectResult;
-    }
-
-    public Args getArgs()
-    {
-        return args;
-    }
-
-    public void setArgs( Args args )
-    {
-        this.args = args;
-    }
-
-    public Results getResults()
-    {
-        return results;
-    }
-
-    public void setResults( Results results )
-    {
-        this.results = results;
-    }
-
-    public List<Dependency> getDependencies()
-    {
-        return dependencies;
-    }
-
-    public void setDependencies( List<Dependency> dependencies )
-    {
-        this.dependencies = dependencies;
-    }
-
-    public List<RemoteRepository> getRepositories()
-    {
-        return repositories;
-    }
-
-    public void setRepositories( List<RemoteRepository> repositories )
-    {
-        this.repositories = repositories;
-    }
-
-    public DependencySelector getDepSelector()
-    {
-        return depSelector;
-    }
-
-    public void setDepSelector( DependencySelector depSelector )
-    {
-        this.depSelector = depSelector;
-    }
-
-    public DependencyManager getDepManager()
-    {
-        return depManager;
-    }
-
-    public void setDepManager( DependencyManager depManager )
-    {
-        this.depManager = depManager;
-    }
-
-    public DependencyTraverser getDepTraverser()
-    {
-        return depTraverser;
-    }
-
-    public void setDepTraverser( DependencyTraverser depTraverser )
-    {
-        this.depTraverser = depTraverser;
-    }
-
-    public VersionFilter getVerFilter()
-    {
-        return verFilter;
-    }
-
-    public void setVerFilter( VersionFilter verFilter )
-    {
-        this.verFilter = verFilter;
-    }
-
-    public void setDependency( Dependency dependency )
+    public void set( Dependency dependency, List<Dependency> managedDependencies )
     {
         artifact = dependency.getArtifact();
         this.dependency = dependency;
-    }
-
-    public void setManagedDependencies( List<Dependency> managedDependencies )
-    {
         this.managedDependencies = managedDependencies;
     }
 
-    public RequestTrace getTrace()
-    {
-        return trace;
-    }
-
-    public void setTrace( RequestTrace trace )
-    {
-        this.trace = trace;
-    }
-
-    public Version getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( Version version )
-    {
-        this.version = version;
-    }
-
     @Override
     public String toString()
     {
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..34bcb39 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
@@ -19,31 +19,20 @@ package org.eclipse.aether.internal.impl.collect;
  * under the License.
  */
 
-import static org.eclipse.aether.internal.impl.collect.DependencyCollectionUtils.addDependencyNode;
-import static org.eclipse.aether.internal.impl.collect.DependencyCollectionUtils.createArtifactDescriptorRequest;
-import static org.eclipse.aether.internal.impl.collect.DependencyCollectionUtils.createDependencyNode;
-import static org.eclipse.aether.internal.impl.collect.DependencyCollectionUtils.createVersionRangeRequest;
-import static org.eclipse.aether.internal.impl.collect.DependencyCollectionUtils.filterVersions;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import static java.util.Objects.requireNonNull;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 
+import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.RepositoryException;
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.RequestTrace;
@@ -53,10 +42,15 @@ import org.eclipse.aether.collection.CollectRequest;
 import org.eclipse.aether.collection.CollectResult;
 import org.eclipse.aether.collection.DependencyCollectionException;
 import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencyManagement;
+import org.eclipse.aether.collection.DependencyManager;
+import org.eclipse.aether.collection.DependencySelector;
 import org.eclipse.aether.collection.DependencyTraverser;
+import org.eclipse.aether.collection.VersionFilter;
 import org.eclipse.aether.graph.DefaultDependencyNode;
 import org.eclipse.aether.graph.Dependency;
 import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.Exclusion;
 import org.eclipse.aether.impl.ArtifactDescriptorReader;
 import org.eclipse.aether.impl.DependencyCollector;
 import org.eclipse.aether.impl.RemoteRepositoryManager;
@@ -72,8 +66,7 @@ import org.eclipse.aether.resolution.VersionRangeResult;
 import org.eclipse.aether.spi.locator.Service;
 import org.eclipse.aether.spi.locator.ServiceLocator;
 import org.eclipse.aether.util.ConfigUtils;
-import org.eclipse.aether.util.concurrency.FutureResult;
-import org.eclipse.aether.util.concurrency.WorkerThreadFactory;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
 import org.eclipse.aether.util.graph.transformer.TransformationContextKeys;
 import org.eclipse.aether.version.Version;
 import org.slf4j.Logger;
@@ -86,12 +79,13 @@ public class DefaultDependencyCollector
     implements DependencyCollector, Service
 {
 
-    static final String CONFIG_PROP_MAX_EXCEPTIONS = "aether.dependencyCollector.maxExceptions";
+    private static final String CONFIG_PROP_MAX_EXCEPTIONS = "aether.dependencyCollector.maxExceptions";
+
+    private static final int CONFIG_PROP_MAX_EXCEPTIONS_DEFAULT = 50;
 
-    static final String CONFIG_PROP_MAX_CYCLES = "aether.dependencyCollector.maxCycles";
+    private static final String CONFIG_PROP_MAX_CYCLES = "aether.dependencyCollector.maxCycles";
 
-    private static final String CONFIG_PROP_THREADS = "aether.artifactDescriptor.threads";
-    private static final int DEFAULT_THREADS = 5;
+    private static final int CONFIG_PROP_MAX_CYCLES_DEFAULT = 10;
 
     private static final Logger LOGGER = LoggerFactory.getLogger( DefaultDependencyCollector.class );
 
@@ -125,8 +119,8 @@ public class DefaultDependencyCollector
 
     public DefaultDependencyCollector setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
     {
-        this.remoteRepositoryManager = requireNonNull(
-                remoteRepositoryManager, "remote repository provider cannot be null" );
+        this.remoteRepositoryManager =
+                requireNonNull( remoteRepositoryManager, "remote repository provider cannot be null" );
         return this;
     }
 
@@ -138,60 +132,80 @@ public class DefaultDependencyCollector
 
     public DefaultDependencyCollector setVersionRangeResolver( VersionRangeResolver versionRangeResolver )
     {
-        this.versionRangeResolver = requireNonNull( versionRangeResolver, "version range resolver cannot be null" );
+        this.versionRangeResolver =
+                requireNonNull( versionRangeResolver, "version range resolver cannot be null" );
         return this;
     }
 
+    @SuppressWarnings( "checkstyle:methodlength" )
     public CollectResult collectDependencies( RepositorySystemSession session, CollectRequest request )
         throws DependencyCollectionException
     {
-        int numThreads = ConfigUtils.getInteger( session, DEFAULT_THREADS, CONFIG_PROP_THREADS );
-        LOGGER.debug( "{} = {} ", CONFIG_PROP_THREADS, numThreads );
-        ThreadPoolExecutor executor = new ThreadPoolExecutor(
-                numThreads, numThreads, 3L, TimeUnit.SECONDS,
-                new LinkedBlockingQueue<Runnable>(), new WorkerThreadFactory( "artifact-descriptor-resolver" ) );
-        try
-        {
-            return collectDependenciesWithExecutor( session, request, executor );
-        }
-        finally
-        {
-            executor.shutdown();
-        }
-    }
-
-    private CollectResult collectDependenciesWithExecutor( RepositorySystemSession session, CollectRequest request,
-                                                           ExecutorService executor )
-        throws DependencyCollectionException
-    {
-        session = DependencyCollectionUtils.optimizeSession( session );
+        session = optimizeSession( session );
 
         RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
 
         CollectResult result = new CollectResult( request );
 
+        DependencySelector depSelector = session.getDependencySelector();
+        DependencyManager depManager = session.getDependencyManager();
+        DependencyTraverser depTraverser = session.getDependencyTraverser();
+        VersionFilter verFilter = session.getVersionFilter();
+
         Dependency root = request.getRoot();
         List<RemoteRepository> repositories = request.getRepositories();
+        List<Dependency> dependencies = request.getDependencies();
         List<Dependency> managedDependencies = request.getManagedDependencies();
 
-        DefaultDependencyCollectionContext context =
-                new DefaultDependencyCollectionContext( session, request.getRootArtifact(), root, managedDependencies );
-        context.setDependencies( request.getDependencies() );
-        context.setCollectResult( result );
-        context.setTrace( trace );
-
-        Args args = new Args( session, trace, null, null, context, null, request, executor );
-        context.setArgs( args );
-
         Map<String, Object> stats = LOGGER.isDebugEnabled() ? new LinkedHashMap<String, Object>() : null;
         long time1 = System.nanoTime();
 
         DefaultDependencyNode node;
         if ( root != null )
         {
+            List<? extends Version> versions;
+            VersionRangeResult rangeResult;
+            try
+            {
+                VersionRangeRequest rangeRequest =
+                    new VersionRangeRequest( root.getArtifact(), request.getRepositories(),
+                                             request.getRequestContext() );
+                rangeRequest.setTrace( trace );
+                rangeResult = versionRangeResolver.resolveVersionRange( session, rangeRequest );
+                versions = filterVersions( root, rangeResult, verFilter, new DefaultVersionFilterContext( session ) );
+            }
+            catch ( VersionRangeResolutionException e )
+            {
+                result.addException( e );
+                throw new DependencyCollectionException( result, e.getMessage() );
+            }
+
+            Version version = versions.get( versions.size() - 1 );
+            root = root.setArtifact( root.getArtifact().setVersion( version.toString() ) );
+
+            ArtifactDescriptorResult descriptorResult;
+            try
+            {
+                ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
+                descriptorRequest.setArtifact( root.getArtifact() );
+                descriptorRequest.setRepositories( request.getRepositories() );
+                descriptorRequest.setRequestContext( request.getRequestContext() );
+                descriptorRequest.setTrace( trace );
+                if ( isLackingDescriptor( root.getArtifact() ) )
+                {
+                    descriptorResult = new ArtifactDescriptorResult( descriptorRequest );
+                }
+                else
+                {
+                    descriptorResult = descriptorReader.readArtifactDescriptor( session, descriptorRequest );
+                }
+            }
+            catch ( ArtifactDescriptorException e )
+            {
+                result.addException( e );
+                throw new DependencyCollectionException( result, e.getMessage() );
+            }
 
-            VersionRangeResult rangeResult = resolveRootVersionRange( context );
-            ArtifactDescriptorResult descriptorResult = readRootArtifactDescriptor( context );
             root = root.setArtifact( descriptorResult.getArtifact() );
 
             if ( !session.isIgnoreArtifactDescriptorRepositories() )
@@ -200,15 +214,14 @@ public class DefaultDependencyCollector
                                                                               descriptorResult.getRepositories(),
                                                                               true );
             }
-            context.setDependencies( mergeDeps( context.getDependencies(), descriptorResult.getDependencies() ) );
-            context.setManagedDependencies( mergeDeps( managedDependencies,
-                    descriptorResult.getManagedDependencies() ) );
+            dependencies = mergeDeps( dependencies, descriptorResult.getDependencies() );
+            managedDependencies = mergeDeps( managedDependencies, descriptorResult.getManagedDependencies() );
 
             node = new DefaultDependencyNode( root );
             node.setRequestContext( request.getRequestContext() );
             node.setRelocations( descriptorResult.getRelocations() );
             node.setVersionConstraint( rangeResult.getVersionConstraint() );
-            node.setVersion( context.getVersion() );
+            node.setVersion( version );
             node.setAliases( descriptorResult.getAliases() );
             node.setRepositories( request.getRepositories() );
         }
@@ -221,41 +234,56 @@ public class DefaultDependencyCollector
 
         result.setRoot( node );
 
-        DependencyTraverser depTraverser = session.getDependencyTraverser();
         boolean traverse = root == null || depTraverser == null || depTraverser.traverseDependency( root );
         String errorPath = null;
-        if ( traverse && !context.getDependencies().isEmpty() )
+        if ( traverse && !dependencies.isEmpty() )
         {
             DataPool pool = new DataPool( session );
 
             NodeStack nodes = new NodeStack();
             nodes.push( node );
 
+            DefaultDependencyCollectionContext context =
+                new DefaultDependencyCollectionContext( session, request.getRootArtifact(), root, managedDependencies );
+
             DefaultVersionFilterContext versionContext = new DefaultVersionFilterContext( session );
 
-            args = new Args( session, trace, pool, nodes, context, versionContext, request, executor );
+            Args args = new Args( session, trace, pool, nodes, context, versionContext, request );
             Results results = new Results( result, session );
-            context.setArgs( args );
-            context.setResults( results );
-            context.setRepositories( repositories );
-            context.setDepTraverser( depTraverser );
-            context.prepareDescent();
 
-            process( context );
+            process( args, results, dependencies, repositories,
+                     depSelector != null ? depSelector.deriveChildSelector( context ) : null,
+                     depManager != null ? depManager.deriveChildManager( context ) : null,
+                     depTraverser != null ? depTraverser.deriveChildTraverser( context ) : null,
+                     verFilter != null ? verFilter.deriveChildFilter( context ) : null );
 
             errorPath = results.errorPath;
         }
 
         long time2 = System.nanoTime();
 
-        transformDependencyGraph( context, stats );
+        DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();
+        if ( transformer != null )
+        {
+            try
+            {
+                DefaultDependencyGraphTransformationContext context =
+                    new DefaultDependencyGraphTransformationContext( session );
+                context.put( TransformationContextKeys.STATS, stats );
+                result.setRoot( transformer.transformGraph( node, context ) );
+            }
+            catch ( RepositoryException e )
+            {
+                result.addException( e );
+            }
+        }
 
         if ( stats != null )
         {
             long time3 = System.nanoTime();
             stats.put( "DefaultDependencyCollector.collectTime", time2 - time1 );
             stats.put( "DefaultDependencyCollector.transformTime", time3 - time2 );
-            LOGGER.debug( "Dependency collection stats: {}", stats );
+            LOGGER.debug( "Dependency collection stats: " + stats );
         }
 
         if ( errorPath != null )
@@ -270,80 +298,11 @@ public class DefaultDependencyCollector
         return result;
     }
 
-    private VersionRangeResult resolveRootVersionRange( DefaultDependencyCollectionContext context )
-        throws DependencyCollectionException
-    {
-        CollectRequest request = context.getArgs().request;
-        RepositorySystemSession session = context.getSession();
-        List<? extends Version> versions;
-        VersionRangeResult rangeResult;
-        Artifact artifact = request.getRoot().getArtifact();
-        try
-        {
-            VersionRangeRequest rangeRequest =
-                    new VersionRangeRequest( artifact, request.getRepositories(), request.getRequestContext() );
-            rangeRequest.setTrace( context.getTrace() );
-            rangeResult = versionRangeResolver.resolveVersionRange( session, rangeRequest );
-            versions = filterVersions( context.getDependency(), rangeResult, context.getVerFilter(),
-                    new DefaultVersionFilterContext( session ) );
-        }
-        catch ( VersionRangeResolutionException e )
-        {
-            context.getCollectResult().addException( e );
-            throw new DependencyCollectionException( context.getCollectResult(), e.getMessage() );
-        }
-
-        Version version = versions.get( versions.size() - 1 );
-        context.setVersion( version );
-        context.setDependency( request.getRoot().setArtifact( artifact.setVersion( version.toString() ) ) );
-        return rangeResult;
-    }
-
-    private ArtifactDescriptorResult readRootArtifactDescriptor( DefaultDependencyCollectionContext context )
-        throws DependencyCollectionException
-    {
-        CollectRequest request = context.getArgs().request;
-        Artifact artifact = request.getRoot().getArtifact();
-        try
-        {
-            ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
-            descriptorRequest.setArtifact( artifact );
-            descriptorRequest.setRepositories( request.getRepositories() );
-            descriptorRequest.setRequestContext( request.getRequestContext() );
-            descriptorRequest.setTrace( context.getTrace() );
-
-            ArtifactDescriptorResult descriptorResult =
-                    isLackingDescriptor( artifact ) ? new ArtifactDescriptorResult( descriptorRequest )
-                            : descriptorReader.readArtifactDescriptor( context.getSession(), descriptorRequest );
-            context.setDependency( request.getRoot().setArtifact( descriptorResult.getArtifact() ) );
-            return descriptorResult;
-        }
-        catch ( ArtifactDescriptorException e )
-        {
-            context.getCollectResult().addException( e );
-            throw new DependencyCollectionException( context.getCollectResult(), e.getMessage() );
-        }
-    }
-
-    private void transformDependencyGraph( DefaultDependencyCollectionContext context, Map<String, Object> stats )
+    private static RepositorySystemSession optimizeSession( RepositorySystemSession session )
     {
-        RepositorySystemSession session = context.getSession();
-        DependencyGraphTransformer transformer = session.getDependencyGraphTransformer();
-        if ( transformer != null )
-        {
-            try
-            {
-                DefaultDependencyGraphTransformationContext tfContext =
-                        new DefaultDependencyGraphTransformationContext( session );
-                tfContext.put( TransformationContextKeys.STATS, stats );
-                context.getCollectResult().setRoot( transformer.transformGraph( context.getCollectResult().getRoot(),
-                        tfContext ) );
-            }
-            catch ( RepositoryException e )
-            {
-                context.getCollectResult().addException( e );
-            }
-        }
+        DefaultRepositorySystemSession optimized = new DefaultRepositorySystemSession( session );
+        optimized.setArtifactTypeRegistry( CachingArtifactTypeRegistry.newInstance( session ) );
+        return optimized;
     }
 
     private List<Dependency> mergeDeps( List<Dependency> dominant, List<Dependency> recessive )
@@ -361,7 +320,7 @@ public class DefaultDependencyCollector
         {
             int initialCapacity = dominant.size() + recessive.size();
             result = new ArrayList<>( initialCapacity );
-            Collection<String> ids = new HashSet<>( initialCapacity, 1.0f );
+            Collection<String> ids = new HashSet<String>( initialCapacity, 1.0f );
             for ( Dependency dependency : dominant )
             {
                 ids.add( getId( dependency.getArtifact() ) );
@@ -383,211 +342,162 @@ public class DefaultDependencyCollector
         return a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getClassifier() + ':' + a.getExtension();
     }
 
-    private void process( DefaultDependencyCollectionContext context )
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private void process( final Args args, Results results, List<Dependency> dependencies,
+                          List<RemoteRepository> repositories, DependencySelector depSelector,
+                          DependencyManager depManager, DependencyTraverser depTraverser, VersionFilter verFilter )
     {
-        List<DependencyContext> depContexts = new ArrayList<>();
-        for ( Dependency d : context.getDependencies() )
+        for ( Dependency dependency : dependencies )
         {
-            depContexts.add( new DependencyContext( context, d ) );
-        }
-
-        List<Future<DependencyContext>> futures = new ArrayList<>();
-        for ( DependencyContext dc : depContexts )
-        {
-            futures.add( asyncProcessDependency( dc ) );
-        }
-        int pos = 0;
-        for ( Future<DependencyContext> future : futures )
-        {
-            try
-            {
-                processDependencyNode( future.get() );
-            }
-            catch ( ExecutionException e )
-            {
-                context.getResults().addException( context.getDependencies().get( pos ), (Exception) e.getCause(),
-                        context.getArgs().nodes );
-            }
-            catch ( InterruptedException e )
-            {
-                context.getResults().addException( context.getDependencies().get( pos ), e, context.getArgs().nodes );
-            }
-            pos++;
+            processDependency( args, results, repositories, depSelector, depManager, depTraverser, verFilter,
+                               dependency );
         }
     }
 
-    private Future<DependencyContext> asyncProcessDependency( final DependencyContext dc )
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private void processDependency( Args args, Results results, List<RemoteRepository> repositories,
+                                    DependencySelector depSelector, DependencyManager depManager,
+                                    DependencyTraverser depTraverser, VersionFilter verFilter, Dependency dependency )
     {
-        return dc.args.executor.submit( new Callable<DependencyContext>()
-        {
-            public DependencyContext call()
-            {
-                return processDependency( dc );
-            }
-        } );
+
+        List<Artifact> relocations = Collections.emptyList();
+        boolean disableVersionManagement = false;
+        processDependency( args, results, repositories, depSelector, depManager, depTraverser, verFilter, dependency,
+                           relocations, disableVersionManagement );
     }
 
-    private DependencyContext processDependency( DependencyContext dc )
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private void processDependency( Args args, Results results, List<RemoteRepository> repositories,
+                                    DependencySelector depSelector, DependencyManager depManager,
+                                    DependencyTraverser depTraverser, VersionFilter verFilter, Dependency dependency,
+                                    List<Artifact> relocations, boolean disableVersionManagement )
     {
-        DefaultDependencyCollectionContext context = dc.context;
-        Args args = context.getArgs();
-        Results results = context.getResults();
 
-        if ( context.getDepSelector() != null && !context.getDepSelector().selectDependency( dc.origDependency ) )
+        if ( depSelector != null && !depSelector.selectDependency( dependency ) )
         {
-            return null;
+            return;
         }
 
         PremanagedDependency preManaged =
-                PremanagedDependency.create( context.getDepManager(), dc.origDependency, dc.disableVersionManagement,
-                                             args.premanagedState );
-        Dependency dependency = preManaged.managedDependency;
+            PremanagedDependency.create( depManager, dependency, disableVersionManagement, args.premanagedState );
+        dependency = preManaged.managedDependency;
 
         boolean noDescriptor = isLackingDescriptor( dependency.getArtifact() );
 
-        boolean traverse = !noDescriptor
-                && ( context.getDepTraverser() == null || context.getDepTraverser().traverseDependency( dependency ) );
+        boolean traverse = !noDescriptor && ( depTraverser == null || depTraverser.traverseDependency( dependency ) );
 
+        List<? extends Version> versions;
+        VersionRangeResult rangeResult;
         try
         {
-            VersionRangeRequest rangeRequest = createVersionRangeRequest( args, context.getRepositories(), dependency );
-            VersionRangeResult rangeResult = cachedResolveRangeResult( rangeRequest, args.pool, args.session );
-            for ( Version version : filterVersions( dependency, rangeResult, context.getVerFilter(),
-                                                    args.versionContext ) )
-            {
+            VersionRangeRequest rangeRequest = createVersionRangeRequest( args, repositories, dependency );
 
-                Artifact originalArtifact = dependency.getArtifact().setVersion( version.toString() );
-                Dependency d = dependency.setArtifact( originalArtifact );
-
-                ArtifactDescriptorRequest descriptorRequest =
-                        createArtifactDescriptorRequest( args, context.getRepositories(), d );
-
-                dc.args = args;
-                dc.preManaged = preManaged;
-                dc.traverse = traverse;
-                dc.rangeResult = rangeResult;
-                dc.version = version;
-                dc.originalArtifact = originalArtifact;
-                dc.managedDependency = d;
-                dc.futureDescriptorResult =
-                        getArtifactDescriptorResult( args, results, noDescriptor, d, descriptorRequest );
-            }
+            rangeResult = cachedResolveRangeResult( rangeRequest, args.pool, args.session );
+
+            versions = filterVersions( dependency, rangeResult, verFilter, args.versionContext );
         }
         catch ( VersionRangeResolutionException e )
         {
             results.addException( dependency, e, args.nodes );
-        }
-        return dc;
-    }
-
-    private void processDependencyNode( DependencyContext dc )
-    {
-        if ( dc == null )
-        {
             return;
         }
-        try
+
+        for ( Version version : versions )
         {
-            boolean noResult = dc.futureDescriptorResult == null;
-            if ( !noResult )
-            {
-                dc.descriptorResult = dc.futureDescriptorResult.get();
-                noResult = dc.descriptorResult == null;
-            }
-            if ( noResult )
-            {
-                List<RemoteRepository> repos =
-                      getRemoteRepositories( dc.rangeResult.getRepository( dc.version ), dc.context.getRepositories() );
-                addDependencyNode( dc.args.nodes.top(), dc.relocations, dc.preManaged, dc.rangeResult, dc.version,
-                                   dc.managedDependency, null, repos, dc.args.request.getRequestContext() );
-            }
-            else
+            Artifact originalArtifact = dependency.getArtifact().setVersion( version.toString() );
+            Dependency d = dependency.setArtifact( originalArtifact );
+
+            ArtifactDescriptorRequest descriptorRequest = createArtifactDescriptorRequest( args, repositories, d );
+
+            final ArtifactDescriptorResult descriptorResult =
+                getArtifactDescriptorResult( args, results, noDescriptor, d, descriptorRequest );
+            if ( descriptorResult != null )
             {
-                processDependencyVersion( dc );
-            }
-        }
-        catch ( InterruptedException e )
-        {
-            dc.context.getResults().addException( dc.preManaged.managedDependency, e, dc.args.nodes );
-        }
-        catch ( ExecutionException e )
-        {
-            dc.context.getResults().addException( dc.preManaged.managedDependency, (Exception) e.getCause(),
-                                                  dc.args.nodes );
-        }
-    }
+                d = d.setArtifact( descriptorResult.getArtifact() );
 
-    private boolean processDependencyVersion( DependencyContext dc )
-    {
-        Args args = dc.context.getArgs();
-        Results results = dc.context.getResults();
-        Dependency d = dc.managedDependency.setArtifact( dc.descriptorResult.getArtifact() );
-        dc.managedDependency = d;
+                DependencyNode node = args.nodes.top();
 
-        DependencyNode node = args.nodes.top();
+                int cycleEntry = args.nodes.find( d.getArtifact() );
+                if ( cycleEntry >= 0 )
+                {
+                    results.addCycle( args.nodes, cycleEntry, d );
+                    DependencyNode cycleNode = args.nodes.get( cycleEntry );
+                    if ( cycleNode.getDependency() != null )
+                    {
+                        DefaultDependencyNode child =
+                            createDependencyNode( relocations, preManaged, rangeResult, version, d, descriptorResult,
+                                                  cycleNode );
+                        node.getChildren().add( child );
+                        continue;
+                    }
+                }
 
-        int cycleEntry = args.nodes.find( d.getArtifact() );
-        if ( cycleEntry >= 0 )
-        {
-            results.addCycle( args.nodes, cycleEntry, d );
-            DependencyNode cycleNode = args.nodes.get( cycleEntry );
-            if ( cycleNode.getDependency() != null )
-            {
-                createDependencyNode( node, dc.relocations, dc.preManaged, dc.rangeResult, dc.version, d,
-                                      dc.descriptorResult, cycleNode );
-                return true;
-            }
-        }
+                if ( !descriptorResult.getRelocations().isEmpty() )
+                {
+                    boolean disableVersionManagementSubsequently =
+                        originalArtifact.getGroupId().equals( d.getArtifact().getGroupId() )
+                            && originalArtifact.getArtifactId().equals( d.getArtifact().getArtifactId() );
 
-        if ( !dc.descriptorResult.getRelocations().isEmpty() )
-        {
-            boolean disableVersionManagementSubsequently =
-                    dc.originalArtifact.getGroupId().equals( d.getArtifact().getGroupId() )
-                            && dc.originalArtifact.getArtifactId().equals( d.getArtifact().getArtifactId() );
+                    processDependency( args, results, repositories, depSelector, depManager, depTraverser, verFilter, d,
+                                       descriptorResult.getRelocations(), disableVersionManagementSubsequently );
+                    return;
+                }
+                else
+                {
+                    d = args.pool.intern( d.setArtifact( args.pool.intern( d.getArtifact() ) ) );
 
-            DependencyContext dc2 = new DependencyContext();
-            dc2.context = dc.context;
-            dc2.origDependency = d;
-            dc2.relocations = dc.descriptorResult.getRelocations();
-            dc2.disableVersionManagement = disableVersionManagementSubsequently;
-            dc2 = processDependency( dc2 );
-            processDependencyNode( dc2 );
-            return true;
-        }
-        else
-        {
-            d = args.pool.intern( d );
+                    List<RemoteRepository> repos =
+                        getRemoteRepositories( rangeResult.getRepository( version ), repositories );
 
-            List<RemoteRepository> repos =
-                    getRemoteRepositories( dc.rangeResult.getRepository( dc.version ), dc.context.getRepositories() );
+                    DefaultDependencyNode child =
+                        createDependencyNode( relocations, preManaged, rangeResult, version, d,
+                                              descriptorResult.getAliases(), repos, args.request.getRequestContext() );
 
-            DefaultDependencyNode child =
-                    addDependencyNode( node, dc.relocations, dc.preManaged, dc.rangeResult, dc.version, d,
-                                       dc.descriptorResult.getAliases(), repos, args.request.getRequestContext() );
+                    node.getChildren().add( child );
 
-            if ( dc.traverse && !dc.descriptorResult.getDependencies().isEmpty() )
+                    boolean recurse = traverse && !descriptorResult.getDependencies().isEmpty();
+                    if ( recurse )
+                    {
+                        doRecurse( args, results, repositories, depSelector, depManager, depTraverser, verFilter, d,
+                                   descriptorResult, child );
+                    }
+                }
+            }
+            else
             {
-                doRecurse( dc.context, d, dc.descriptorResult, child );
+                DependencyNode node = args.nodes.top();
+                List<RemoteRepository> repos =
+                    getRemoteRepositories( rangeResult.getRepository( version ), repositories );
+                DefaultDependencyNode child =
+                    createDependencyNode( relocations, preManaged, rangeResult, version, d, null, repos,
+                                          args.request.getRequestContext() );
+                node.getChildren().add( child );
             }
-            return false;
         }
     }
 
-    private void doRecurse( DefaultDependencyCollectionContext context, Dependency d,
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private void doRecurse( Args args, Results results, List<RemoteRepository> repositories,
+                            DependencySelector depSelector, DependencyManager depManager,
+                            DependencyTraverser depTraverser, VersionFilter verFilter, Dependency d,
                             ArtifactDescriptorResult descriptorResult, DefaultDependencyNode child )
     {
-        context.setDependency( d );
-        context.setManagedDependencies( descriptorResult.getManagedDependencies() );
+        DefaultDependencyCollectionContext context = args.collectionContext;
+        context.set( d, descriptorResult.getManagedDependencies() );
 
-        DefaultDependencyCollectionContext childContext = context.createChildContext();
-        Args args = context.getArgs();
+        DependencySelector childSelector = depSelector != null ? depSelector.deriveChildSelector( context ) : null;
+        DependencyManager childManager = depManager != null ? depManager.deriveChildManager( context ) : null;
+        DependencyTraverser childTraverser = depTraverser != null ? depTraverser.deriveChildTraverser( context ) : null;
+        VersionFilter childFilter = verFilter != null ? verFilter.deriveChildFilter( context ) : null;
 
-        final List<RemoteRepository> childRepos = args.ignoreRepos ? context.getRepositories()
-                : remoteRepositoryManager.aggregateRepositories( args.session, context.getRepositories(),
-                descriptorResult.getRepositories(), true );
-        childContext.setRepositories( childRepos );
+        final List<RemoteRepository> childRepos =
+            args.ignoreRepos
+                ? repositories
+                : remoteRepositoryManager.aggregateRepositories( args.session, repositories,
+                                                                 descriptorResult.getRepositories(), true );
 
-        Object key = args.pool.toKey( d.getArtifact(), childContext );
+        Object key =
+            args.pool.toKey( d.getArtifact(), childRepos, childSelector, childManager, childTraverser, childFilter );
 
         List<DependencyNode> children = args.pool.getChildren( key );
         if ( children == null )
@@ -596,11 +506,8 @@ public class DefaultDependencyCollector
 
             args.nodes.push( child );
 
-            childContext.setArgs( args );
-            childContext.setResults( context.getResults() );
-            childContext.setDependencies( descriptorResult.getDependencies() );
-
-            process( childContext );
+            process( args, results, descriptorResult.getDependencies(), childRepos, childSelector, childManager,
+                     childTraverser, childFilter );
 
             args.nodes.pop();
         }
@@ -610,50 +517,100 @@ public class DefaultDependencyCollector
         }
     }
 
-    private Future<ArtifactDescriptorResult> getArtifactDescriptorResult( Args args, Results results,
-                                                                          boolean noDescriptor, Dependency d,
-                                                                          ArtifactDescriptorRequest descriptorRequest )
+    private ArtifactDescriptorResult getArtifactDescriptorResult( Args args, Results results, boolean noDescriptor,
+                                                                  Dependency d,
+                                                                  ArtifactDescriptorRequest descriptorRequest )
     {
         return noDescriptor
-                ? new FutureResult<>( new ArtifactDescriptorResult( descriptorRequest ) )
-                : resolveCachedArtifactDescriptor( args.pool, descriptorRequest, args.session, d, results,
-                args );
+                   ? new ArtifactDescriptorResult( descriptorRequest )
+                   : resolveCachedArtifactDescriptor( args.pool, descriptorRequest, args.session, d, results, args );
+
     }
 
-    private Future<ArtifactDescriptorResult> resolveCachedArtifactDescriptor(
-            final DataPool pool, final ArtifactDescriptorRequest descriptorRequest,
-            final RepositorySystemSession session, final Dependency d, final Results results, final Args args )
+    private ArtifactDescriptorResult resolveCachedArtifactDescriptor( DataPool pool,
+                                                                      ArtifactDescriptorRequest descriptorRequest,
+                                                                      RepositorySystemSession session, Dependency d,
+                                                                      Results results, Args args )
     {
-        final Object key = pool.toKey( descriptorRequest );
-        Future<ArtifactDescriptorResult> descriptorResult = pool.getDescriptor( key, descriptorRequest );
+        Object key = pool.toKey( descriptorRequest );
+        ArtifactDescriptorResult descriptorResult = pool.getDescriptor( key, descriptorRequest );
         if ( descriptorResult == null )
         {
-            descriptorResult = args.executor.submit( new Callable<ArtifactDescriptorResult>()
+            try
             {
-                public ArtifactDescriptorResult call()
-                {
-                    try
-                    {
-                        return descriptorReader.readArtifactDescriptor( session, descriptorRequest );
-                    }
-                    catch ( ArtifactDescriptorException e )
-                    {
-                        results.addException( d, e, args.nodes );
-                        pool.putDescriptor( key, e );
-                        return null;
-                    }
-                }
-            } );
+                descriptorResult = descriptorReader.readArtifactDescriptor( session, descriptorRequest );
+                pool.putDescriptor( key, descriptorResult );
+            }
+            catch ( ArtifactDescriptorException e )
+            {
+                results.addException( d, e, args.nodes );
+                pool.putDescriptor( key, e );
+                return null;
+            }
 
-            pool.putDescriptor( key, descriptorResult );
         }
         else if ( descriptorResult == DataPool.NO_DESCRIPTOR )
         {
-            return new FutureResult<>( null );
+            return null;
         }
 
         return descriptorResult;
     }
+
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private static DefaultDependencyNode createDependencyNode( List<Artifact> relocations,
+                                                               PremanagedDependency preManaged,
+                                                               VersionRangeResult rangeResult, Version version,
+                                                               Dependency d, Collection<Artifact> aliases,
+                                                               List<RemoteRepository> repos, String requestContext )
+    {
+        DefaultDependencyNode child = new DefaultDependencyNode( d );
+        preManaged.applyTo( child );
+        child.setRelocations( relocations );
+        child.setVersionConstraint( rangeResult.getVersionConstraint() );
+        child.setVersion( version );
+        child.setAliases( aliases );
+        child.setRepositories( repos );
+        child.setRequestContext( requestContext );
+        return child;
+    }
+
+    private static DefaultDependencyNode createDependencyNode( List<Artifact> relocations,
+                                                               PremanagedDependency preManaged,
+                                                               VersionRangeResult rangeResult, Version version,
+                                                               Dependency d, ArtifactDescriptorResult descriptorResult,
+                                                               DependencyNode cycleNode )
+    {
+        DefaultDependencyNode child =
+            createDependencyNode( relocations, preManaged, rangeResult, version, d, descriptorResult.getAliases(),
+                                  cycleNode.getRepositories(), cycleNode.getRequestContext() );
+        child.setChildren( cycleNode.getChildren() );
+        return child;
+    }
+
+    private static ArtifactDescriptorRequest createArtifactDescriptorRequest( Args args,
+                                                                              List<RemoteRepository> repositories,
+                                                                              Dependency d )
+    {
+        ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
+        descriptorRequest.setArtifact( d.getArtifact() );
+        descriptorRequest.setRepositories( repositories );
+        descriptorRequest.setRequestContext( args.request.getRequestContext() );
+        descriptorRequest.setTrace( args.trace );
+        return descriptorRequest;
+    }
+
+    private static VersionRangeRequest createVersionRangeRequest( Args args, List<RemoteRepository> repositories,
+                                                                  Dependency dependency )
+    {
+        VersionRangeRequest rangeRequest = new VersionRangeRequest();
+        rangeRequest.setArtifact( dependency.getArtifact() );
+        rangeRequest.setRepositories( repositories );
+        rangeRequest.setRequestContext( args.request.getRequestContext() );
+        rangeRequest.setTrace( args.trace );
+        return rangeRequest;
+    }
+
     private VersionRangeResult cachedResolveRangeResult( VersionRangeRequest rangeRequest, DataPool pool,
                                                          RepositorySystemSession session )
         throws VersionRangeResolutionException
@@ -686,4 +643,261 @@ public class DefaultDependencyCollector
         }
         return repositories;
     }
+
+    private static List<? extends Version> filterVersions( Dependency dependency, VersionRangeResult rangeResult,
+                                                           VersionFilter verFilter,
+                                                           DefaultVersionFilterContext verContext )
+        throws VersionRangeResolutionException
+    {
+        if ( rangeResult.getVersions().isEmpty() )
+        {
+            throw new VersionRangeResolutionException( rangeResult,
+                                                       "No versions available for " + dependency.getArtifact()
+                                                           + " within specified range" );
+        }
+
+        List<? extends Version> versions;
+        if ( verFilter != null && rangeResult.getVersionConstraint().getRange() != null )
+        {
+            verContext.set( dependency, rangeResult );
+            try
+            {
+                verFilter.filterVersions( verContext );
+            }
+            catch ( RepositoryException e )
+            {
+                throw new VersionRangeResolutionException( rangeResult,
+                                                           "Failed to filter versions for " + dependency.getArtifact()
+                                                               + ": " + e.getMessage(), e );
+            }
+            versions = verContext.get();
+            if ( versions.isEmpty() )
+            {
+                throw new VersionRangeResolutionException( rangeResult,
+                                                           "No acceptable versions for " + dependency.getArtifact()
+                                                               + ": " + rangeResult.getVersions() );
+            }
+        }
+        else
+        {
+            versions = rangeResult.getVersions();
+        }
+        return versions;
+    }
+
+    static class Args
+    {
+
+        final RepositorySystemSession session;
+
+        final boolean ignoreRepos;
+
+        final boolean premanagedState;
+
+        final RequestTrace trace;
+
+        final DataPool pool;
+
+        final NodeStack nodes;
+
+        final DefaultDependencyCollectionContext collectionContext;
+
+        final DefaultVersionFilterContext versionContext;
+
+        final CollectRequest request;
+
+        Args( RepositorySystemSession session, RequestTrace trace, DataPool pool, NodeStack nodes,
+                     DefaultDependencyCollectionContext collectionContext, DefaultVersionFilterContext versionContext,
+                     CollectRequest request )
+        {
+            this.session = session;
+            this.request = request;
+            this.ignoreRepos = session.isIgnoreArtifactDescriptorRepositories();
+            this.premanagedState = ConfigUtils.getBoolean( session, false, DependencyManagerUtils.CONFIG_PROP_VERBOSE );
+            this.trace = trace;
+            this.pool = pool;
+            this.nodes = nodes;
+            this.collectionContext = collectionContext;
+            this.versionContext = versionContext;
+        }
+
+    }
+
+    static class Results
+    {
+
+        private final CollectResult result;
+
+        final int maxExceptions;
+
+        final int maxCycles;
+
+        String errorPath;
+
+        Results( CollectResult result, RepositorySystemSession session )
+        {
+            this.result = result;
+
+            maxExceptions =
+                    ConfigUtils.getInteger( session, CONFIG_PROP_MAX_EXCEPTIONS_DEFAULT, CONFIG_PROP_MAX_EXCEPTIONS );
+
+            maxCycles = ConfigUtils.getInteger( session, CONFIG_PROP_MAX_CYCLES_DEFAULT, CONFIG_PROP_MAX_CYCLES );
+        }
+
+        public void addException( Dependency dependency, Exception e, NodeStack nodes )
+        {
+            if ( maxExceptions < 0 || result.getExceptions().size() < maxExceptions )
+            {
+                result.addException( e );
+                if ( errorPath == null )
+                {
+                    StringBuilder buffer = new StringBuilder( 256 );
+                    for ( int i = 0; i < nodes.size(); i++ )
+                    {
+                        if ( buffer.length() > 0 )
+                        {
+                            buffer.append( " -> " );
+                        }
+                        Dependency dep = nodes.get( i ).getDependency();
+                        if ( dep != null )
+                        {
+                            buffer.append( dep.getArtifact() );
+                        }
+                    }
+                    if ( buffer.length() > 0 )
+                    {
+                        buffer.append( " -> " );
+                    }
+                    buffer.append( dependency.getArtifact() );
+                    errorPath = buffer.toString();
+                }
+            }
+        }
+
+        public void addCycle( NodeStack nodes, int cycleEntry, Dependency dependency )
+        {
+            if ( maxCycles < 0 || result.getCycles().size() < maxCycles )
+            {
+                result.addCycle( new DefaultDependencyCycle( nodes, cycleEntry, dependency ) );
+            }
+        }
+
+    }
+
+    static class PremanagedDependency
+    {
+
+        final String premanagedVersion;
+
+        final String premanagedScope;
+
+        final Boolean premanagedOptional;
+
+        /**
+         * @since 1.1.0
+         */
+        final Collection<Exclusion> premanagedExclusions;
+
+        /**
+         * @since 1.1.0
+         */
+        final Map<String, String> premanagedProperties;
+
+        final int managedBits;
+
+        final Dependency managedDependency;
+
+        final boolean premanagedState;
+
+        @SuppressWarnings( "checkstyle:parameternumber" )
+        PremanagedDependency( String premanagedVersion, String premanagedScope, Boolean premanagedOptional,
+                              Collection<Exclusion> premanagedExclusions, Map<String, String> premanagedProperties,
+                              int managedBits, Dependency managedDependency, boolean premanagedState )
+        {
+            this.premanagedVersion = premanagedVersion;
+            this.premanagedScope = premanagedScope;
+            this.premanagedOptional = premanagedOptional;
+            this.premanagedExclusions =
+                premanagedExclusions != null
+                    ? Collections.unmodifiableCollection( new ArrayList<>( premanagedExclusions ) )
+                    : null;
+
+            this.premanagedProperties =
+                premanagedProperties != null
+                    ? Collections.unmodifiableMap( new HashMap<>( premanagedProperties ) )
+                    : null;
+
+            this.managedBits = managedBits;
+            this.managedDependency = managedDependency;
+            this.premanagedState = premanagedState;
+        }
+
+        static PremanagedDependency create( DependencyManager depManager, Dependency dependency,
+                                            boolean disableVersionManagement, boolean premanagedState )
+        {
+            DependencyManagement depMngt = depManager != null ? depManager.manageDependency( dependency ) : null;
+
+            int managedBits = 0;
+            String premanagedVersion = null;
+            String premanagedScope = null;
+            Boolean premanagedOptional = null;
+            Collection<Exclusion> premanagedExclusions = null;
+            Map<String, String> premanagedProperties = null;
+
+            if ( depMngt != null )
+            {
+                if ( depMngt.getVersion() != null && !disableVersionManagement )
+                {
+                    Artifact artifact = dependency.getArtifact();
+                    premanagedVersion = artifact.getVersion();
+                    dependency = dependency.setArtifact( artifact.setVersion( depMngt.getVersion() ) );
+                    managedBits |= DependencyNode.MANAGED_VERSION;
+                }
+                if ( depMngt.getProperties() != null )
+                {
+                    Artifact artifact = dependency.getArtifact();
+                    premanagedProperties = artifact.getProperties();
+                    dependency = dependency.setArtifact( artifact.setProperties( depMngt.getProperties() ) );
+                    managedBits |= DependencyNode.MANAGED_PROPERTIES;
+                }
+                if ( depMngt.getScope() != null )
+                {
+                    premanagedScope = dependency.getScope();
+                    dependency = dependency.setScope( depMngt.getScope() );
+                    managedBits |= DependencyNode.MANAGED_SCOPE;
+                }
+                if ( depMngt.getOptional() != null )
+                {
+                    premanagedOptional = dependency.isOptional();
+                    dependency = dependency.setOptional( depMngt.getOptional() );
+                    managedBits |= DependencyNode.MANAGED_OPTIONAL;
+                }
+                if ( depMngt.getExclusions() != null )
+                {
+                    premanagedExclusions = dependency.getExclusions();
+                    dependency = dependency.setExclusions( depMngt.getExclusions() );
+                    managedBits |= DependencyNode.MANAGED_EXCLUSIONS;
+                }
+            }
+            return new PremanagedDependency( premanagedVersion, premanagedScope, premanagedOptional,
+                                             premanagedExclusions, premanagedProperties, managedBits, dependency,
+                                             premanagedState );
+
+        }
+
+        public void applyTo( DefaultDependencyNode child )
+        {
+            child.setManagedBits( managedBits );
+            if ( premanagedState )
+            {
+                child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_VERSION, premanagedVersion );
+                child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_SCOPE, premanagedScope );
+                child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_OPTIONAL, premanagedOptional );
+                child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_EXCLUSIONS, premanagedExclusions );
+                child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_PROPERTIES, premanagedProperties );
+            }
+        }
+
+    }
+
 }
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyCollectionUtils.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyCollectionUtils.java
deleted file mode 100644
index 876301b..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyCollectionUtils.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.aether.internal.impl.collect;
-
-/*
- * 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 java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.artifact.ArtifactProperties;
-import org.eclipse.aether.collection.VersionFilter;
-import org.eclipse.aether.graph.DefaultDependencyNode;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.repository.ArtifactRepository;
-import org.eclipse.aether.repository.RemoteRepository;
-import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.resolution.VersionRangeRequest;
-import org.eclipse.aether.resolution.VersionRangeResolutionException;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.version.Version;
-
-/**
- * Utility methods for dependency collection.
- *
- */
-public class DependencyCollectionUtils
-{
-
-    @SuppressWarnings( "checkstyle:parameternumber" )
-    static DefaultDependencyNode addDependencyNode( DependencyNode parent, List<Artifact> relocations,
-                                                    PremanagedDependency preManaged, VersionRangeResult rangeResult,
-                                                    Version version, Dependency d, Collection<Artifact> aliases,
-                                                    List<RemoteRepository> repos, String requestContext )
-    {
-        DefaultDependencyNode child = new DefaultDependencyNode( d );
-        preManaged.applyTo( child );
-        child.setRelocations( relocations );
-        child.setVersionConstraint( rangeResult.getVersionConstraint() );
-        child.setVersion( version );
-        child.setAliases( aliases );
-        child.setRepositories( repos );
-        child.setRequestContext( requestContext );
-        parent.getChildren().add( child );
-        return child;
-    }
-
-    @SuppressWarnings( "checkstyle:parameternumber" )
-    static DefaultDependencyNode createDependencyNode( DependencyNode parent, List<Artifact> relocations,
-                                                       PremanagedDependency preManaged, VersionRangeResult rangeResult,
-                                                       Version version, Dependency d,
-                                                       ArtifactDescriptorResult descriptorResult,
-                                                       DependencyNode cycleNode )
-    {
-        DefaultDependencyNode child =
-            addDependencyNode( parent, relocations, preManaged, rangeResult, version, d, descriptorResult.getAliases(),
-                               cycleNode.getRepositories(), cycleNode.getRequestContext() );
-        child.setChildren( cycleNode.getChildren() );
-        return child;
-    }
-
-    static ArtifactDescriptorRequest createArtifactDescriptorRequest( Args args, List<RemoteRepository> repositories,
-                                                                      Dependency d )
-    {
-        ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
-        descriptorRequest.setArtifact( d.getArtifact() );
-        descriptorRequest.setRepositories( repositories );
-        descriptorRequest.setRequestContext( args.request.getRequestContext() );
-        descriptorRequest.setTrace( args.trace );
-        return descriptorRequest;
-    }
-
-    static VersionRangeRequest createVersionRangeRequest( Args args, List<RemoteRepository> repositories,
-                                                          Dependency dependency )
-    {
-        VersionRangeRequest rangeRequest = new VersionRangeRequest();
-        rangeRequest.setArtifact( dependency.getArtifact() );
-        rangeRequest.setRepositories( repositories );
-        rangeRequest.setRequestContext( args.request.getRequestContext() );
-        rangeRequest.setTrace( args.trace );
-        return rangeRequest;
-    }
-
-    static boolean isLackingDescriptor( Artifact artifact )
-    {
-        return artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ) != null;
-    }
-
-    static List<RemoteRepository> getRemoteRepositories( ArtifactRepository repository,
-                                                         List<RemoteRepository> repositories )
-    {
-        if ( repository instanceof RemoteRepository )
-        {
-            return Collections.singletonList( (RemoteRepository) repository );
-        }
-        if ( repository != null )
-        {
-            return Collections.emptyList();
-        }
-        return repositories;
-    }
-
-    static List<? extends Version> filterVersions( Dependency dependency, VersionRangeResult rangeResult,
-                                                   VersionFilter verFilter, DefaultVersionFilterContext verContext )
-        throws VersionRangeResolutionException
-    {
-        if ( rangeResult.getVersions().isEmpty() )
-        {
-            throw new VersionRangeResolutionException( rangeResult, "No versions available for "
-                + dependency.getArtifact() + " within specified range" );
-        }
-
-        List<? extends Version> versions;
-        if ( verFilter != null && rangeResult.getVersionConstraint().getRange() != null )
-        {
-            verContext.set( dependency, rangeResult );
-            try
-            {
-                verFilter.filterVersions( verContext );
-            }
-            catch ( RepositoryException e )
-            {
-                throw new VersionRangeResolutionException( rangeResult, "Failed to filter versions for "
-                    + dependency.getArtifact() + ": " + e.getMessage(), e );
-            }
-            versions = verContext.get();
-            if ( versions.isEmpty() )
-            {
-                throw new VersionRangeResolutionException( rangeResult, "No acceptable versions for "
-                    + dependency.getArtifact() + ": " + rangeResult.getVersions() );
-            }
-        }
-        else
-        {
-            versions = rangeResult.getVersions();
-        }
-        return versions;
-    }
-
-    static RepositorySystemSession optimizeSession( RepositorySystemSession session )
-    {
-        DefaultRepositorySystemSession optimized = new DefaultRepositorySystemSession( session );
-        optimized.setArtifactTypeRegistry( CachingArtifactTypeRegistry.newInstance( session ) );
-        return optimized;
-    }
-
-    static String getId( Dependency d )
-    {
-        Artifact a = d.getArtifact();
-        return a.getGroupId() + ':' + a.getArtifactId() + ':' + a.getClassifier() + ':' + a.getExtension();
-    }
-}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyContext.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyContext.java
deleted file mode 100644
index 48af70f..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyContext.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.aether.internal.impl.collect;
-
-/*
- * 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 java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Future;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.resolution.VersionRangeResult;
-import org.eclipse.aether.version.Version;
-
-class DependencyContext
-{
-    Dependency origDependency;
-
-    DefaultDependencyCollectionContext context;
-
-    List<Artifact> relocations;
-
-    boolean disableVersionManagement;
-
-    Args args;
-
-    PremanagedDependency preManaged;
-
-    boolean traverse;
-
-    VersionRangeResult rangeResult;
-
-    Version version;
-
-    Artifact originalArtifact;
-
-    Dependency managedDependency;
-
-    Future<ArtifactDescriptorResult> futureDescriptorResult;
-
-    ArtifactDescriptorResult descriptorResult;
-
-    DependencyContext()
-    {
-        // empty
-    }
-
-    DependencyContext( DefaultDependencyCollectionContext context, Dependency dependency )
-    {
-        this.context = context;
-        this.origDependency = dependency;
-        this.relocations = Collections.emptyList();
-        this.disableVersionManagement = false;
-        this.args = context.getArgs();
-    }
-
-}
\ No newline at end of file
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/PremanagedDependency.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/PremanagedDependency.java
deleted file mode 100644
index 361213e..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/PremanagedDependency.java
+++ /dev/null
@@ -1,149 +0,0 @@
-package org.eclipse.aether.internal.impl.collect;
-
-/*
- * 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.aether.artifact.Artifact;
-import org.eclipse.aether.collection.DependencyManagement;
-import org.eclipse.aether.collection.DependencyManager;
-import org.eclipse.aether.graph.DefaultDependencyNode;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-import org.eclipse.aether.graph.Exclusion;
-import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
-
-class PremanagedDependency
-{
-    final String premanagedVersion;
-
-    final String premanagedScope;
-
-    final Boolean premanagedOptional;
-
-    /**
-     * @since 1.4.0
-     */
-    final Collection<Exclusion> premanagedExclusions;
-
-    /**
-     * @since 1.4.0
-     */
-    final Map<String, String> premanagedProperties;
-
-    final int managedBits;
-
-    final Dependency managedDependency;
-
-    final boolean premanagedState;
-
-    @SuppressWarnings( "checkstyle:parameternumber" )
-    PremanagedDependency( String premanagedVersion, String premanagedScope, Boolean premanagedOptional,
-                          Collection<Exclusion> premanagedExclusions, Map<String, String> premanagedProperties,
-                          int managedBits, Dependency managedDependency, boolean premanagedState )
-    {
-        this.premanagedVersion = premanagedVersion;
-        this.premanagedScope = premanagedScope;
-        this.premanagedOptional = premanagedOptional;
-        this.premanagedExclusions =
-            premanagedExclusions != null
-                ? Collections.unmodifiableCollection( new ArrayList<>( premanagedExclusions ) )
-                : null;
-
-        this.premanagedProperties =
-            premanagedProperties != null
-                ? Collections.unmodifiableMap( new HashMap<>( premanagedProperties ) )
-                : null;
-
-        this.managedBits = managedBits;
-        this.managedDependency = managedDependency;
-        this.premanagedState = premanagedState;
-    }
-
-    static PremanagedDependency create( DependencyManager depManager, Dependency dependency,
-                                        boolean disableVersionManagement, boolean premanagedState )
-    {
-        DependencyManagement depMngt = depManager != null ? depManager.manageDependency( dependency ) : null;
-
-        int managedBits = 0;
-        String premanagedVersion = null;
-        String premanagedScope = null;
-        Boolean premanagedOptional = null;
-        Collection<Exclusion> premanagedExclusions = null;
-        Map<String, String> premanagedProperties = null;
-
-        if ( depMngt != null )
-        {
-            if ( depMngt.getVersion() != null && !disableVersionManagement )
-            {
-                Artifact artifact = dependency.getArtifact();
-                premanagedVersion = artifact.getVersion();
-                dependency = dependency.setArtifact( artifact.setVersion( depMngt.getVersion() ) );
-                managedBits |= DependencyNode.MANAGED_VERSION;
-            }
-            if ( depMngt.getProperties() != null )
-            {
-                Artifact artifact = dependency.getArtifact();
-                premanagedProperties = artifact.getProperties();
-                dependency = dependency.setArtifact( artifact.setProperties( depMngt.getProperties() ) );
-                managedBits |= DependencyNode.MANAGED_PROPERTIES;
-            }
-            if ( depMngt.getScope() != null )
-            {
-                premanagedScope = dependency.getScope();
-                dependency = dependency.setScope( depMngt.getScope() );
-                managedBits |= DependencyNode.MANAGED_SCOPE;
-            }
-            if ( depMngt.getOptional() != null )
-            {
-                premanagedOptional = dependency.isOptional();
-                dependency = dependency.setOptional( depMngt.getOptional() );
-                managedBits |= DependencyNode.MANAGED_OPTIONAL;
-            }
-            if ( depMngt.getExclusions() != null )
-            {
-                premanagedExclusions = dependency.getExclusions();
-                dependency = dependency.setExclusions( depMngt.getExclusions() );
-                managedBits |= DependencyNode.MANAGED_EXCLUSIONS;
-            }
-        }
-        return new PremanagedDependency( premanagedVersion, premanagedScope, premanagedOptional,
-                                         premanagedExclusions, premanagedProperties, managedBits, dependency,
-                                         premanagedState );
-
-    }
-
-    public void applyTo( DefaultDependencyNode child )
-    {
-        child.setManagedBits( managedBits );
-        if ( premanagedState )
-        {
-            child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_VERSION, premanagedVersion );
-            child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_SCOPE, premanagedScope );
-            child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_OPTIONAL, premanagedOptional );
-            child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_EXCLUSIONS, premanagedExclusions );
-            child.setData( DependencyManagerUtils.NODE_DATA_PREMANAGED_PROPERTIES, premanagedProperties );
-        }
-    }
-}
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Results.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Results.java
deleted file mode 100644
index 27d6121..0000000
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/Results.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.aether.internal.impl.collect;
-
-/*
- * 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.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.collection.CollectResult;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.util.ConfigUtils;
-
-class Results
-{
-
-    private final CollectResult result;
-
-    private final int maxExceptions;
-
-    private final int maxCycles;
-
-    String errorPath;
-
-    @SuppressWarnings( { "checkstyle:magicnumber" } )
-    Results( CollectResult result, RepositorySystemSession session )
-    {
-        this.result = result;
-        maxExceptions = ConfigUtils.getInteger( session, 50, DefaultDependencyCollector.CONFIG_PROP_MAX_EXCEPTIONS );
-        maxCycles = ConfigUtils.getInteger( session, 10, DefaultDependencyCollector.CONFIG_PROP_MAX_CYCLES );
-    }
-
-    public void addException( Dependency dependency, Exception e, NodeStack nodes )
-    {
-        if ( maxExceptions < 0 || result.getExceptions().size() < maxExceptions )
-        {
-            result.addException( e );
-            if ( errorPath == null )
-            {
-                StringBuilder buffer = new StringBuilder( 256 );
-                for ( int i = 0; i < nodes.size(); i++ )
-                {
-                    if ( buffer.length() > 0 )
-                    {
-                        buffer.append( " -> " );
-                    }
-                    Dependency dep = nodes.get( i ).getDependency();
-                    if ( dep != null )
-                    {
-                        buffer.append( dep.getArtifact() );
-                    }
-                }
-                if ( buffer.length() > 0 )
-                {
-                    buffer.append( " -> " );
-                }
-                buffer.append( dependency.getArtifact() );
-                errorPath = buffer.toString();
-            }
-        }
-    }
-
-    public void addCycle( NodeStack nodes, int cycleEntry, Dependency dependency )
-    {
-        if ( maxCycles < 0 || result.getCycles().size() < maxCycles )
-        {
-            result.addCycle( new DefaultDependencyCycle( nodes, cycleEntry, dependency ) );
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DataPoolTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DataPoolTest.java
index 2ac1855..6baffd2 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DataPoolTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/collect/DataPoolTest.java
@@ -18,11 +18,6 @@ package org.eclipse.aether.internal.impl.collect;
  * specific language governing permissions and limitations
  * under the License.
  */
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 
 import org.eclipse.aether.DefaultRepositorySystemSession;
 import org.eclipse.aether.artifact.DefaultArtifact;
@@ -30,9 +25,11 @@ import org.eclipse.aether.graph.Dependency;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
 import org.eclipse.aether.resolution.ArtifactDescriptorResult;
-import org.eclipse.aether.util.concurrency.FutureResult;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 public class DataPoolTest
 {
 
@@ -42,7 +39,7 @@ public class DataPoolTest
     }
 
     @Test
-    public void testArtifactDescriptorCaching() throws InterruptedException, ExecutionException
+    public void testArtifactDescriptorCaching()
     {
         ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
         request.setArtifact( new DefaultArtifact( "gid:aid:1" ) );
@@ -53,14 +50,12 @@ public class DataPoolTest
         result.addManagedDependency( new Dependency( new DefaultArtifact( "gid:mdep:3" ), "runtime" ) );
         result.addRepository( new RemoteRepository.Builder( "test", "default", "http://localhost" ).build() );
         result.addAlias( new DefaultArtifact( "gid:alias:4" ) );
-        Future<ArtifactDescriptorResult> futureResult = new FutureResult<>( result );
 
         DataPool pool = newDataPool();
         Object key = pool.toKey( request );
-        pool.putDescriptor( key, futureResult );
-        Future<ArtifactDescriptorResult> futureCached = pool.getDescriptor( key, request );
-        assertNotNull( futureCached );
-        ArtifactDescriptorResult cached = futureCached.get();
+        pool.putDescriptor( key, result );
+        ArtifactDescriptorResult cached = pool.getDescriptor( key, request );
+        assertNotNull( cached );
         assertEquals( result.getArtifact(), cached.getArtifact() );
         assertEquals( result.getRelocations(), cached.getRelocations() );
         assertEquals( result.getDependencies(), cached.getDependencies() );
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..3232040 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
@@ -68,7 +68,6 @@ import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
 import org.eclipse.aether.util.graph.manager.DefaultDependencyManager;
 import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
 import org.eclipse.aether.util.graph.manager.TransitiveDependencyManager;
-import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
 import org.eclipse.aether.util.graph.version.HighestVersionFilter;
 import org.junit.Before;
 import org.junit.Test;
@@ -569,44 +568,6 @@ public class DefaultDependencyCollectorTest
         assertEquals( 1, result.getRoot().getChildren().size() );
     }
 
-    /**
-     * 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()
-        throws DependencyCollectionException
-    {
-        session.setDependencySelector( new ScopeDependencySelector( "provided", "test" ) );
-        session.setDependencyManager( new ClassicDependencyManager() );
-
-        Dependency dependency = newDep( "gid3:aid1:ext:1", "compile" );
-        CollectRequest request = new CollectRequest( dependency, Arrays.asList( repository ) );
-        CollectResult result = collector.collectDependencies( session, request );
-
-        assertEquals( 0, result.getExceptions().size() );
-
-        DependencyNode root = result.getRoot();
-        Dependency newDependency = root.getDependency();
-
-        assertEquals( dependency, newDependency );
-        assertEquals( dependency.getArtifact(), newDependency.getArtifact() );
-
-        assertEquals( 1, root.getChildren().size() );
-
-        Dependency expect = newDep( "gid3:aid2:ext:1", "compile" );
-        DependencyNode childLevel1 = root.getChildren().get( 0 );
-        assertEquals( expect, childLevel1.getDependency() );
-
-        // 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() );
-    }
-
     static class TestDependencyManager
         implements DependencyManager
     {
diff --git a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid1_1.ini b/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid1_1.ini
deleted file mode 100644
index ffc6dbd..0000000
--- a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid1_1.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[dependencies]
-gid3:aid2:ext:1:compile
-
-[managed-dependencies]
-gid3:aid3:ext:1:compile:!optional
-
-
diff --git a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid2_1.ini b/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid2_1.ini
deleted file mode 100644
index 8d64166..0000000
--- a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid2_1.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[dependencies]
-gid3:aid3:ext:2:test:optional
diff --git a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_1.ini b/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_1.ini
deleted file mode 100644
index 4322fc6..0000000
--- a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_1.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[dependencies]
-
diff --git a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_2.ini b/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_2.ini
deleted file mode 100644
index 4322fc6..0000000
--- a/maven-resolver-impl/src/test/resources/artifact-descriptions/gid3_aid3_2.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[dependencies]
-
diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/FutureResult.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/FutureResult.java
deleted file mode 100644
index dbbe1df..0000000
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/FutureResult.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.aether.util.concurrency;
-
-/*
- * 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 java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Wraps a result value as a Future.
- *
- * @param <T> result type
- */
-public class FutureResult<T>
-    implements Future<T>
-{
-    private final T value;
-
-    public FutureResult( T value )
-    {
-        this.value = value;
-    }
-
-    @Override
-    public boolean cancel( boolean mayInterruptIfRunning )
-    {
-        return false;
-    }
-
-    @Override
-    public boolean isCancelled()
-    {
-        return false;
-    }
-
-    @Override
-    public boolean isDone()
-    {
-        return true;
-    }
-
-    @Override
-    public T get()
-    {
-        return value;
-    }
-
-    @Override
-    public T get( long timeout, TimeUnit unit )
-    {
-        return value;
-    }
-}


Mime
View raw message