diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index 5fc55288e7..b8f1c3bfeb 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -63,21 +63,10 @@ under the License. org.apache.maven.wagon wagon-http - shaded - - - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpcore - - - org.apache.maven.wagon - wagon-http-shared - - + + + org.apache.maven.wagon + wagon-file org.slf4j @@ -86,12 +75,16 @@ under the License. runtime - org.apache.maven.wagon - wagon-file + org.apache.maven.resolver + maven-resolver-connector-basic org.apache.maven.resolver - maven-resolver-connector-basic + maven-resolver-transport-file + + + org.apache.maven.resolver + maven-resolver-transport-http org.apache.maven.resolver diff --git a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java index d157e7621d..80c6ba7946 100644 --- a/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java +++ b/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java @@ -78,6 +78,22 @@ import org.slf4j.LoggerFactory; @Named public class DefaultRepositorySystemSessionFactory { + private static final String MAVEN_TRANSPORT_KEY = "maven.transport"; + + private static final String MAVEN_TRANSPORT_WAGON = "wagon"; + + private static final String MAVEN_TRANSPORT_RESOLVER = "resolver"; + + private static final String MAVEN_TRANSPORT_AUTO = "auto"; + + private static final String WAGON_TRANSPORTER_KEY_PRIORITY_KEY = "aether.priority.WagonTransporterFactory"; + + private static final String RESOLVER_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory"; + + private static final String RESOLVER_FILE_TRANSPORTER_PRIORITY_KEY = "aether.priority.FileTransporterFactory"; + + private static final String RESOLVER_MAX_PRIORITY = String.valueOf( Float.MAX_VALUE ); + private final Logger logger = LoggerFactory.getLogger( getClass() ); private final ArtifactHandlerManager artifactHandlerManager; @@ -245,6 +261,25 @@ public class DefaultRepositorySystemSessionFactory } session.setAuthenticationSelector( authSelector ); + String transport = request.getUserProperties().getProperty( MAVEN_TRANSPORT_KEY, MAVEN_TRANSPORT_WAGON ); + if ( MAVEN_TRANSPORT_RESOLVER.equals( transport ) ) + { + // Make sure (whatever extra priority is set) that resolver native is selected + configProps.put( RESOLVER_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY ); + configProps.put( RESOLVER_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY ); + } + else if ( MAVEN_TRANSPORT_WAGON.equals( transport ) ) + { + // Make sure (whatever extra priority is set) that wagon is selected + configProps.put( WAGON_TRANSPORTER_KEY_PRIORITY_KEY, RESOLVER_MAX_PRIORITY ); + } + else if ( !MAVEN_TRANSPORT_AUTO.equals( transport ) ) + { + throw new IllegalArgumentException( "Unknown maven.transport=" + transport + + ". Supported ones are: " + MAVEN_TRANSPORT_WAGON + ", " + + MAVEN_TRANSPORT_RESOLVER + " and " + MAVEN_TRANSPORT_AUTO ); + } + session.setTransferListener( request.getTransferListener() ); session.setRepositoryListener( eventSpyDispatcher.chainListener( new LoggingRepositoryListener( logger ) ) ); diff --git a/maven-resolver-provider/pom.xml b/maven-resolver-provider/pom.xml index 0027e348f4..5b416a4ef3 100644 --- a/maven-resolver-provider/pom.xml +++ b/maven-resolver-provider/pom.xml @@ -117,12 +117,12 @@ under the License. org.apache.maven.resolver - maven-resolver-transport-wagon + maven-resolver-transport-file test - org.apache.maven.wagon - wagon-file + org.apache.maven.resolver + maven-resolver-transport-http test diff --git a/pom.xml b/pom.xml index 4c2c09c749..f5e1dff208 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ under the License. 2.0 2.0.0 1.3 - 1.7.2 + 1.7.3 1.7.32 2.6.4 true @@ -340,7 +340,6 @@ under the License. org.apache.maven.wagon wagon-http ${wagonVersion} - shaded @@ -368,6 +367,16 @@ under the License. maven-resolver-connector-basic ${resolverVersion} + + org.apache.maven.resolver + maven-resolver-transport-file + ${resolverVersion} + + + org.apache.maven.resolver + maven-resolver-transport-http + ${resolverVersion} + org.apache.maven.resolver maven-resolver-transport-wagon