Preparations for resolver alpha-3 (#1328)

Updates Maven to Resolver 2.0.0-alpha-3, that is mostly about renames and config changes. 

Related changes for ITs are here: https://github.com/apache/maven-integration-testing/pull/322

---

https://issues.apache.org/jira/browse/MNG-7946
https://issues.apache.org/jira/browse/MNG-7948
This commit is contained in:
Tamas Cservenak 2023-12-06 15:08:35 +01:00 committed by GitHub
parent 4af662f7b3
commit 2411c81a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 39 deletions

View File

@ -88,7 +88,7 @@ under the License.
<!-- HTTP/1.1, medium priority, Java8+ -->
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<artifactId>maven-resolver-transport-apache</artifactId>
</dependency>
<!-- HTTP/1.1 and HTTP/2, high priority, Java11+ -->
<dependency>

View File

@ -92,16 +92,6 @@ public class DefaultRepositorySystemSessionFactory {
*/
private static final String MAVEN_REPO_LOCAL_TAIL = "maven.repo.local.tail";
/**
* User property for chained LRM: should artifact availability be ignored in tail local repositories or not.
* Default: {@code true}, will ignore availability from tail local repositories.
*
* @since 3.9.0
* @deprecated Use {@link ChainedLocalRepositoryManager#IGNORE_TAIL_AVAILABILITY} instead.
*/
@Deprecated
private static final String MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY = "maven.repo.local.tail.ignoreAvailability";
/**
* User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local
* repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local
@ -134,7 +124,7 @@ public class DefaultRepositorySystemSessionFactory {
private static final String WAGON_TRANSPORTER_PRIORITY_KEY = "aether.priority.WagonTransporterFactory";
private static final String APACHE_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.HttpTransporterFactory";
private static final String APACHE_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.ApacheTransporterFactory";
private static final String JDK_HTTP_TRANSPORTER_PRIORITY_KEY = "aether.priority.JdkTransporterFactory";
@ -198,25 +188,6 @@ public class DefaultRepositorySystemSessionFactory {
configProps.putAll(request.getSystemProperties());
configProps.putAll(request.getUserProperties());
// we need to "translate" this
if (configProps.containsKey(MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY)) {
logger.warn(
"User property {} is DEPRECATED, switch to {}",
MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY,
ChainedLocalRepositoryManager.IGNORE_TAIL_AVAILABILITY);
configProps.put(
ChainedLocalRepositoryManager.IGNORE_TAIL_AVAILABILITY,
configProps.get(MAVEN_REPO_LOCAL_TAIL_IGNORE_AVAILABILITY));
}
// HACK: Resolver 2.0.0-alpha-2 carries a bad change:
// https://github.com/apache/maven-resolver/commit/178cfba9f3889f7e942a6a0d74716355b01a78f5
// that is fixed in later versions by MRESOLVER-437 https://github.com/apache/maven-resolver/pull/373
// TODO: remove this hack below once Resolver PR above is applied
if (!configProps.containsKey(ConfigurationProperties.HTTP_EXPECT_CONTINUE)) {
configProps.put(ConfigurationProperties.HTTP_EXPECT_CONTINUE, Boolean.FALSE.toString());
}
session.setOffline(request.isOffline());
session.setChecksumPolicy(request.getGlobalChecksumPolicy());
session.setUpdatePolicy(
@ -277,6 +248,8 @@ public class DefaultRepositorySystemSessionFactory {
}
session.setProxySelector(proxySelector);
// Note: we do NOT use WagonTransportConfigurationKeys here as Maven Core does NOT depend on Wagon Transport
// and this is okay and "good thing".
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
for (Server server : decrypted.getServers()) {
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
@ -291,7 +264,7 @@ public class DefaultRepositorySystemSessionFactory {
.collect(Collectors.toList());
dom = new XmlNodeImpl(dom.getName(), null, null, children, null);
PlexusConfiguration config = XmlPlexusConfiguration.toPlexusConfiguration(dom);
configProps.put("aether.connector.wagon.config." + server.getId(), config);
configProps.put("aether.transport.wagon.config." + server.getId(), config);
// Translate to proper resolver configuration properties as well (as Plexus XML above is Wagon specific
// only) but support only configuration/httpConfiguration/all, see
@ -363,8 +336,8 @@ public class DefaultRepositorySystemSessionFactory {
}
}
configProps.put("aether.connector.perms.fileMode." + server.getId(), server.getFilePermissions());
configProps.put("aether.connector.perms.dirMode." + server.getId(), server.getDirectoryPermissions());
configProps.put("aether.transport.wagon.perms.fileMode." + server.getId(), server.getFilePermissions());
configProps.put("aether.transport.wagon.perms.dirMode." + server.getId(), server.getDirectoryPermissions());
}
session.setAuthenticationSelector(authSelector);

View File

@ -148,7 +148,7 @@ public class DefaultRepositorySystemSessionFactoryTest {
PlexusConfiguration plexusConfiguration = (PlexusConfiguration) systemSessionFactory
.newRepositorySession(request)
.getConfigProperties()
.get("aether.connector.wagon.config.repository");
.get("aether.transport.wagon.config.repository");
assertNotNull(plexusConfiguration);
assertEquals(0, plexusConfiguration.getChildCount());
}
@ -370,7 +370,7 @@ public class DefaultRepositorySystemSessionFactoryTest {
Map<String, Object> configProperties =
systemSessionFactory.newRepositorySession(request).getConfigProperties();
assertEquals(String.valueOf(Float.MAX_VALUE), configProperties.get("aether.priority.FileTransporterFactory"));
assertEquals(String.valueOf(Float.MAX_VALUE), configProperties.get("aether.priority.HttpTransporterFactory"));
assertEquals(String.valueOf(Float.MAX_VALUE), configProperties.get("aether.priority.ApacheTransporterFactory"));
properties.remove("maven.resolver.transport");
// wagon

View File

@ -120,7 +120,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<artifactId>maven-resolver-transport-apache</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -176,7 +176,7 @@ under the License.
<plexusInterpolationVersion>1.26</plexusInterpolationVersion>
<plexusTestingVersion>1.0.0</plexusTestingVersion>
<plexusXmlVersion>4.0.1</plexusXmlVersion>
<resolverVersion>2.0.0-alpha-2</resolverVersion>
<resolverVersion>2.0.0-alpha-3</resolverVersion>
<securityDispatcherVersion>2.0</securityDispatcherVersion>
<sisuVersion>0.9.0.M2</sisuVersion>
<slf4jVersion>1.7.36</slf4jVersion>
@ -389,7 +389,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<artifactId>maven-resolver-transport-apache</artifactId>
<version>${resolverVersion}</version>
</dependency>
<dependency>