mirror of https://github.com/apache/maven.git
[MNG-7982] Switch to enable transitivity in depMgr used by Maven (#1357)
Resolver 2.0.0-alpha-6 introduced "transitive" switch to dependency Manager, make use of it. --- https://issues.apache.org/jira/browse/MNG-7982
This commit is contained in:
parent
f1c53cbfdf
commit
5261ba9203
|
@ -66,6 +66,7 @@ import org.eclipse.aether.repository.RemoteRepository;
|
|||
import org.eclipse.aether.repository.RepositoryPolicy;
|
||||
import org.eclipse.aether.repository.WorkspaceReader;
|
||||
import org.eclipse.aether.resolution.ResolutionErrorPolicy;
|
||||
import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
|
||||
import org.eclipse.aether.util.listener.ChainedRepositoryListener;
|
||||
import org.eclipse.aether.util.repository.AuthenticationBuilder;
|
||||
import org.eclipse.aether.util.repository.ChainedLocalRepositoryManager;
|
||||
|
@ -102,6 +103,19 @@ public class DefaultRepositorySystemSessionFactory {
|
|||
*/
|
||||
private static final String MAVEN_REPO_LOCAL_RECORD_REVERSE_TREE = "maven.repo.local.recordReverseTree";
|
||||
|
||||
/**
|
||||
* User property for selecting dependency manager behaviour regarding transitive dependencies and dependency
|
||||
* management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored
|
||||
* dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence
|
||||
* unlike Maven2, obeys dependency management entries deep in dependency graph as well.
|
||||
* <p>
|
||||
* Default: {@code "true"}.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private static final String MAVEN_RESOLVER_DEPENDENCY_MANAGER_TRANSITIVITY_KEY =
|
||||
"maven.resolver.dependencyManagerTransitivity";
|
||||
|
||||
private static final String MAVEN_RESOLVER_TRANSPORT_KEY = "maven.resolver.transport";
|
||||
|
||||
private static final String MAVEN_RESOLVER_TRANSPORT_DEFAULT = "default";
|
||||
|
@ -393,6 +407,11 @@ public class DefaultRepositorySystemSessionFactory {
|
|||
injectProxy(proxySelector, request.getPluginArtifactRepositories());
|
||||
injectAuthentication(authSelector, request.getPluginArtifactRepositories());
|
||||
|
||||
String resolverDependencyManagerTransitivity = (String)
|
||||
configProps.getOrDefault(MAVEN_RESOLVER_DEPENDENCY_MANAGER_TRANSITIVITY_KEY, Boolean.TRUE.toString());
|
||||
session.setDependencyManager(
|
||||
new ClassicDependencyManager(Boolean.parseBoolean(resolverDependencyManagerTransitivity)));
|
||||
|
||||
ArrayList<File> paths = new ArrayList<>();
|
||||
paths.add(new File(request.getLocalRepository().getBasedir()));
|
||||
String localRepoTail = (String) configProps.get(MAVEN_REPO_LOCAL_TAIL);
|
||||
|
|
Loading…
Reference in New Issue