diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index 7704a9a19c00..de432eefd054 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -80,13 +80,20 @@ under the License.
org.apache.maven.resolver
maven-resolver-transport-file
+
+
+ org.apache.maven.resolver
+ maven-resolver-transport-wagon
+
+
org.apache.maven.resolver
maven-resolver-transport-http
+
org.apache.maven.resolver
- maven-resolver-transport-wagon
+ maven-resolver-transport-jdk
org.apache.maven
diff --git a/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
index 733026c4f060..85fd0c1f5a3a 100644
--- a/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
+++ b/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
@@ -51,11 +51,11 @@
import org.codehaus.plexus.testing.PlexusTest;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.DefaultRepositorySystem;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import static org.codehaus.plexus.testing.PlexusExtension.getBasedir;
+import static org.mockito.Mockito.mock;
@PlexusTest
public abstract class AbstractCoreMavenComponentTestCase {
@@ -150,7 +150,8 @@ protected MavenSession createMavenSession(File pom, Properties executionProperti
getContainer(), configuration.getRepositorySession(), request, new DefaultMavenExecutionResult());
session.setProjects(projects);
session.setAllProjects(session.getProjects());
- session.setSession(new DefaultSession(session, new DefaultRepositorySystem(), null, null, null, null));
+ session.setSession(
+ new DefaultSession(session, mock(org.eclipse.aether.RepositorySystem.class), null, null, null, null));
return session;
}
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 215597d6ebda..a0e29f1d818f 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
@@ -109,13 +109,25 @@ public class DefaultRepositorySystemSessionFactory {
private static final String MAVEN_RESOLVER_TRANSPORT_WAGON = "wagon";
+ private static final String MAVEN_RESOLVER_TRANSPORT_APACHE = "apache";
+
+ private static final String MAVEN_RESOLVER_TRANSPORT_JDK = "jdk";
+
+ /**
+ * This name for Apache HttpClient transport is deprecated.
+ *
+ * @deprecated Renamed to {@link #MAVEN_RESOLVER_TRANSPORT_APACHE}
+ */
+ @Deprecated
private static final String MAVEN_RESOLVER_TRANSPORT_NATIVE = "native";
private static final String MAVEN_RESOLVER_TRANSPORT_AUTO = "auto";
private static final String WAGON_TRANSPORTER_PRIORITY_KEY = "aether.priority.WagonTransporterFactory";
- private static final String NATIVE_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory";
+ private static final String APACHE_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory";
+
+ private static final String JDK_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.JdkTransporterFactory";
private static final String NATIVE_FILE_TRANSPORTER_PRIORITY_KEY = "aether.priority.FileTransporterFactory";
@@ -322,17 +334,29 @@ public DefaultRepositorySystemSession newRepositorySession(MavenExecutionRequest
Object transport = configProps.getOrDefault(MAVEN_RESOLVER_TRANSPORT_KEY, MAVEN_RESOLVER_TRANSPORT_DEFAULT);
if (MAVEN_RESOLVER_TRANSPORT_DEFAULT.equals(transport)) {
// The "default" mode (user did not set anything) from now on defaults to AUTO
- } else if (MAVEN_RESOLVER_TRANSPORT_NATIVE.equals(transport)) {
- // Make sure (whatever extra priority is set) that resolver native is selected
+ } else if (MAVEN_RESOLVER_TRANSPORT_JDK.equals(transport)) {
+ // Make sure (whatever extra priority is set) that resolver file/jdk is selected
+ configProps.put(NATIVE_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
+ configProps.put(JDK_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
+ } else if (MAVEN_RESOLVER_TRANSPORT_APACHE.equals(transport)
+ || MAVEN_RESOLVER_TRANSPORT_NATIVE.equals(transport)) {
+ if (MAVEN_RESOLVER_TRANSPORT_NATIVE.equals(transport)) {
+ logger.warn(
+ "Transport name '{}' is DEPRECATED/RENAMED, use '{}' instead",
+ MAVEN_RESOLVER_TRANSPORT_NATIVE,
+ MAVEN_RESOLVER_TRANSPORT_APACHE);
+ }
+ // Make sure (whatever extra priority is set) that resolver file/apache is selected
configProps.put(NATIVE_FILE_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
- configProps.put(NATIVE_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
+ configProps.put(APACHE_HTTP_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
} else if (MAVEN_RESOLVER_TRANSPORT_WAGON.equals(transport)) {
// Make sure (whatever extra priority is set) that wagon is selected
configProps.put(WAGON_TRANSPORTER_PRIORITY_KEY, RESOLVER_MAX_PRIORITY);
} else if (!MAVEN_RESOLVER_TRANSPORT_AUTO.equals(transport)) {
throw new IllegalArgumentException("Unknown resolver transport '" + transport
+ "'. Supported transports are: " + MAVEN_RESOLVER_TRANSPORT_WAGON + ", "
- + MAVEN_RESOLVER_TRANSPORT_NATIVE + ", " + MAVEN_RESOLVER_TRANSPORT_AUTO);
+ + MAVEN_RESOLVER_TRANSPORT_APACHE + ", " + MAVEN_RESOLVER_TRANSPORT_JDK + ", "
+ + MAVEN_RESOLVER_TRANSPORT_AUTO);
}
session.setUserProperties(request.getUserProperties());
diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
index c406898f0619..e08814fd48a2 100644
--- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
@@ -50,11 +50,12 @@
import org.codehaus.plexus.testing.PlexusTest;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.DefaultRepositorySystem;
+import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import static org.codehaus.plexus.testing.PlexusExtension.getBasedir;
+import static org.mockito.Mockito.mock;
@PlexusTest
public abstract class AbstractCoreMavenComponentTestCase {
@@ -149,7 +150,7 @@ protected MavenSession createMavenSession(File pom, Properties executionProperti
getContainer(), configuration.getRepositorySession(), request, new DefaultMavenExecutionResult());
session.setProjects(projects);
session.setAllProjects(session.getProjects());
- session.setSession(new DefaultSession(session, new DefaultRepositorySystem(), null, null, null, null));
+ session.setSession(new DefaultSession(session, mock(RepositorySystem.class), null, null, null, null));
return session;
}
diff --git a/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java b/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java
index fe2bbe8b44b6..f21c07ae6d56 100644
--- a/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java
+++ b/maven-core/src/test/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactoryTest.java
@@ -362,7 +362,7 @@ void transportConfigurationTest() throws InvalidRepositoryException {
// native
Properties properties = new Properties();
- properties.setProperty("maven.resolver.transport", "native");
+ properties.setProperty("maven.resolver.transport", "apache");
request.setSystemProperties(properties);
Map configProperties =
systemSessionFactory.newRepositorySession(request).getConfigProperties();
@@ -387,7 +387,7 @@ void transportConfigurationTest() throws InvalidRepositoryException {
IllegalArgumentException exception = assertThrowsExactly(
IllegalArgumentException.class, () -> systemSessionFactory.newRepositorySession(request));
assertEquals(
- "Unknown resolver transport 'illegal'. Supported transports are: wagon, native, auto",
+ "Unknown resolver transport 'illegal'. Supported transports are: wagon, apache, jdk, auto",
exception.getMessage());
properties.remove("maven.resolver.transport");
}
diff --git a/maven-core/src/test/java/org/apache/maven/internal/impl/DefaultSessionTest.java b/maven-core/src/test/java/org/apache/maven/internal/impl/DefaultSessionTest.java
index dd516c91a34a..e8ff9c0443dc 100644
--- a/maven-core/src/test/java/org/apache/maven/internal/impl/DefaultSessionTest.java
+++ b/maven-core/src/test/java/org/apache/maven/internal/impl/DefaultSessionTest.java
@@ -25,12 +25,13 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.root.RootLocator;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
-import org.eclipse.aether.internal.impl.DefaultRepositorySystem;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.mock;
public class DefaultSessionTest {
@@ -40,7 +41,7 @@ void testRootDirectoryWithNull() {
DefaultMavenExecutionRequest mer = new DefaultMavenExecutionRequest();
MavenSession ms = new MavenSession(null, rss, mer, null);
DefaultSession session =
- new DefaultSession(ms, new DefaultRepositorySystem(), Collections.emptyList(), null, null, null);
+ new DefaultSession(ms, mock(RepositorySystem.class), Collections.emptyList(), null, null, null);
assertEquals(
RootLocator.UNABLE_TO_FIND_ROOT_PROJECT_MESSAGE,
@@ -55,7 +56,7 @@ void testRootDirectory() {
MavenSession ms = new MavenSession(null, rss, mer, null);
ms.getRequest().setRootDirectory(Paths.get("myRootDirectory"));
DefaultSession session =
- new DefaultSession(ms, new DefaultRepositorySystem(), Collections.emptyList(), null, null, null);
+ new DefaultSession(ms, mock(RepositorySystem.class), Collections.emptyList(), null, null, null);
assertEquals(Paths.get("myRootDirectory"), session.getRootDirectory());
}
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4Test.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4Test.java
index 630119241a7e..cc1c73173536 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4Test.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4Test.java
@@ -61,7 +61,7 @@
import org.codehaus.plexus.configuration.DefaultPlexusConfiguration;
import org.codehaus.plexus.util.Os;
import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.DefaultRepositorySystem;
+import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
@@ -75,6 +75,7 @@
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
/**
*/
@@ -419,8 +420,7 @@ private ExpressionEvaluator createExpressionEvaluator(
mavenSession.setCurrentProject(project);
mavenSession.getRequest().setRootDirectory(rootDirectory);
- DefaultSession session =
- new DefaultSession(mavenSession, new DefaultRepositorySystem(), null, null, null, null);
+ DefaultSession session = new DefaultSession(mavenSession, mock(RepositorySystem.class), null, null, null, null);
MojoDescriptor mojo = new MojoDescriptor();
mojo.setPluginDescriptor(pluginDescriptor);
@@ -458,7 +458,7 @@ private MojoExecution newMojoExecution() {
}
private DefaultSession newSession() throws Exception {
- return new DefaultSession(newMavenSession(), new DefaultRepositorySystem(), null, null, null, null);
+ return new DefaultSession(newMavenSession(), mock(RepositorySystem.class), null, null, null, null);
}
private MavenSession newMavenSession() throws Exception {
diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java
deleted file mode 100644
index b04cd3aeea49..000000000000
--- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/MavenResolverModule.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-package org.apache.maven.repository.internal;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.name.Names;
-import org.apache.maven.model.building.DefaultModelBuilderFactory;
-import org.apache.maven.model.building.ModelBuilder;
-import org.eclipse.aether.impl.ArtifactDescriptorReader;
-import org.eclipse.aether.impl.MetadataGeneratorFactory;
-import org.eclipse.aether.impl.VersionRangeResolver;
-import org.eclipse.aether.impl.VersionResolver;
-import org.eclipse.aether.impl.guice.AetherModule;
-import org.eclipse.aether.version.VersionScheme;
-
-/**
- * MavenResolverModule
- */
-@Deprecated
-public final class MavenResolverModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new AetherModule());
- bind(VersionScheme.class).toProvider(new DefaultVersionSchemeProvider());
- bind(ArtifactDescriptorReader.class)
- .to(DefaultArtifactDescriptorReader.class)
- .in(Singleton.class);
- bind(VersionResolver.class).to(DefaultVersionResolver.class).in(Singleton.class);
- bind(VersionRangeResolver.class).to(DefaultVersionRangeResolver.class).in(Singleton.class);
- bind(MetadataGeneratorFactory.class)
- .annotatedWith(Names.named("snapshot"))
- .to(SnapshotMetadataGeneratorFactory.class)
- .in(Singleton.class);
- bind(MetadataGeneratorFactory.class)
- .annotatedWith(Names.named("versions"))
- .to(VersionsMetadataGeneratorFactory.class)
- .in(Singleton.class);
- bind(ModelBuilder.class).toInstance(new DefaultModelBuilderFactory().newInstance());
- bind(ModelCacheFactory.class).to(DefaultModelCacheFactory.class).in(Singleton.class);
- }
-
- @Provides
- @Singleton
- Set provideMetadataGeneratorFactories(
- @Named("snapshot") MetadataGeneratorFactory snapshot,
- @Named("versions") MetadataGeneratorFactory versions) {
- Set factories = new HashSet<>(2);
- factories.add(snapshot);
- factories.add(versions);
- return Collections.unmodifiableSet(factories);
- }
-}
diff --git a/pom.xml b/pom.xml
index 9ac5ff8b4a17..3da429628583 100644
--- a/pom.xml
+++ b/pom.xml
@@ -161,7 +161,7 @@ under the License.
2.0
2.0
1.3
- 1.9.16
+ 2.0.0-alpha-1
0.9.0.M2
9.5
1.7.36
@@ -377,6 +377,11 @@ under the License.
maven-resolver-transport-http
${resolverVersion}
+
+ org.apache.maven.resolver
+ maven-resolver-transport-jdk
+ ${resolverVersion}
+
org.apache.maven.resolver
maven-resolver-transport-wagon