From 922cc2e8fb6e293664fe033e409d975380192918 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Thu, 12 Dec 2024 23:27:36 +0100 Subject: [PATCH] [MNG-8430] Rsolver 2.0.5 Prepare for Resolver 2.0.5 --- https://issues.apache.org/jira/browse/MNG-8430 --- .../maven/internal/aether/MavenInstaller.java | 58 ------------------- ...venDeployer.java => MavenTransformer.java} | 27 ++++----- .../standalone/RepositorySystemSupplier.java | 4 ++ pom.xml | 7 ++- src/site/markdown/configuration.properties | 2 +- src/site/markdown/configuration.yaml | 2 +- src/site/markdown/maven-configuration.md | 2 +- 7 files changed, 25 insertions(+), 77 deletions(-) delete mode 100644 impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenInstaller.java rename impl/maven-core/src/main/java/org/apache/maven/internal/aether/{MavenDeployer.java => MavenTransformer.java} (64%) diff --git a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenInstaller.java b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenInstaller.java deleted file mode 100644 index d7f2f95f1402..000000000000 --- a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenInstaller.java +++ /dev/null @@ -1,58 +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.internal.aether; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.internal.transformation.ConsumerPomArtifactTransformer; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.impl.Installer; -import org.eclipse.aether.installation.InstallRequest; -import org.eclipse.aether.installation.InstallResult; -import org.eclipse.aether.installation.InstallationException; -import org.eclipse.aether.internal.impl.DefaultInstaller; -import org.eclipse.sisu.Priority; - -import static java.util.Objects.requireNonNull; - -/** - * Maven specific installer. - */ -@Singleton -@Named -@Priority(100) -final class MavenInstaller implements Installer { - - private final DefaultInstaller installer; - - private final ConsumerPomArtifactTransformer consumerPomArtifactTransformer; - - @Inject - MavenInstaller(DefaultInstaller installer, ConsumerPomArtifactTransformer consumerPomArtifactTransformer) { - this.installer = requireNonNull(installer); - this.consumerPomArtifactTransformer = requireNonNull(consumerPomArtifactTransformer); - } - - @Override - public InstallResult install(RepositorySystemSession session, InstallRequest request) throws InstallationException { - return installer.install(session, consumerPomArtifactTransformer.remapInstallArtifacts(session, request)); - } -} diff --git a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenDeployer.java b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenTransformer.java similarity index 64% rename from impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenDeployer.java rename to impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenTransformer.java index 93aa84418ee8..01e6ebbdffe0 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenDeployer.java +++ b/impl/maven-core/src/main/java/org/apache/maven/internal/aether/MavenTransformer.java @@ -25,34 +25,31 @@ import org.apache.maven.internal.transformation.ConsumerPomArtifactTransformer; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.deployment.DeployRequest; -import org.eclipse.aether.deployment.DeployResult; -import org.eclipse.aether.deployment.DeploymentException; -import org.eclipse.aether.impl.Deployer; -import org.eclipse.aether.internal.impl.DefaultDeployer; -import org.eclipse.sisu.Priority; +import org.eclipse.aether.installation.InstallRequest; +import org.eclipse.aether.spi.artifact.transformer.ArtifactTransformer; import static java.util.Objects.requireNonNull; /** - * Maven specific deployer. + * Maven specific transformer. */ @Singleton @Named -@Priority(100) -final class MavenDeployer implements Deployer { - - private final DefaultDeployer deployer; - +final class MavenTransformer implements ArtifactTransformer { private final ConsumerPomArtifactTransformer consumerPomArtifactTransformer; @Inject - MavenDeployer(DefaultDeployer deployer, ConsumerPomArtifactTransformer consumerPomArtifactTransformer) { - this.deployer = requireNonNull(deployer); + MavenTransformer(ConsumerPomArtifactTransformer consumerPomArtifactTransformer) { this.consumerPomArtifactTransformer = requireNonNull(consumerPomArtifactTransformer); } @Override - public DeployResult deploy(RepositorySystemSession session, DeployRequest request) throws DeploymentException { - return deployer.deploy(session, consumerPomArtifactTransformer.remapDeployArtifacts(session, request)); + public InstallRequest transformInstallArtifacts(RepositorySystemSession session, InstallRequest request) { + return consumerPomArtifactTransformer.remapInstallArtifacts(session, request); + } + + @Override + public DeployRequest transformDeployArtifacts(RepositorySystemSession session, DeployRequest request) { + return consumerPomArtifactTransformer.remapDeployArtifacts(session, request); } } diff --git a/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/standalone/RepositorySystemSupplier.java b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/standalone/RepositorySystemSupplier.java index 0d1423a7a30b..a341c4a2efef 100644 --- a/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/standalone/RepositorySystemSupplier.java +++ b/impl/maven-impl/src/test/java/org/apache/maven/internal/impl/standalone/RepositorySystemSupplier.java @@ -99,6 +99,8 @@ /** * DI Bridge for Maven Resolver + * + * TODO: reuse mvn4 Supplier here */ @SuppressWarnings("unused") public class RepositorySystemSupplier { @@ -397,6 +399,7 @@ static Installer newInstaller( repositoryEventDispatcher, artifactFactories != null ? artifactFactories : Map.of(), metadataFactories, + Map.of(), syncContextFactory); } @@ -419,6 +422,7 @@ static Deployer newDeployer( updateCheckManager, artifactFactories != null ? artifactFactories : Map.of(), metadataFactories, + Map.of(), syncContextFactory, offlineController); } diff --git a/pom.xml b/pom.xml index 1e628a340f27..46a52f86b51f 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@ under the License. 1.27 1.4.0 4.0.4 - 2.0.4 + 2.0.5-SNAPSHOT 4.0.3 0.9.0.M3 2.0.16 @@ -562,6 +562,11 @@ under the License. maven-resolver-transport-wagon ${resolverVersion} + + org.apache.maven.resolver + maven-resolver-supplier-mvn4 + ${resolverVersion} + commons-cli diff --git a/src/site/markdown/configuration.properties b/src/site/markdown/configuration.properties index 44b45571ff2a..7bb64bd28392 100644 --- a/src/site/markdown/configuration.properties +++ b/src/site/markdown/configuration.properties @@ -172,7 +172,7 @@ props.26.description = props.26.defaultValue = ${maven.user.conf}/settings-security4.xml props.26.configurationSource = User properties props.27.key = maven.startInstant -props.27.configurationType = String +props.27.configurationType = java.time.Instant props.27.description = User property used to store the build timestamp. props.27.defaultValue = props.27.since = 4.1.0 diff --git a/src/site/markdown/configuration.yaml b/src/site/markdown/configuration.yaml index f225960935a4..cbfbce280fa9 100644 --- a/src/site/markdown/configuration.yaml +++ b/src/site/markdown/configuration.yaml @@ -172,7 +172,7 @@ props: defaultValue: ${maven.user.conf}/settings-security4.xml configurationSource: User properties - key: maven.startInstant - configurationType: String + configurationType: java.time.Instant description: "User property used to store the build timestamp." defaultValue: since: 4.1.0 diff --git a/src/site/markdown/maven-configuration.md b/src/site/markdown/maven-configuration.md index aa4eada9edda..8f79f44c14df 100644 --- a/src/site/markdown/maven-configuration.md +++ b/src/site/markdown/maven-configuration.md @@ -51,7 +51,7 @@ under the License. | 24. | `maven.resolver.transport` | `String` | Resolver transport to use. Can be default, wagon, apache, jdk or auto. | `default` | 4.0.0 | User properties | | 25. | `maven.session.versionFilter` | `String` | User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3).
Supported filters: Example filter expression: "h(5);s;e(org.foo:bar:1) will cause: ranges are filtered for "top 5" (instead full range), snapshots are banned if root project is not a snapshot, and if range for org.foo:bar is being processed, version 1 is omitted. Value in this property builds org.eclipse.aether.collection.VersionFilter instance. | - | 4.0.0 | User properties | | 26. | `maven.settings.security` | `String` | | `${maven.user.conf}/settings-security4.xml` | | User properties | -| 27. | `maven.startInstant` | `String` | User property used to store the build timestamp. | - | 4.1.0 | User properties | +| 27. | `maven.startInstant` | `java.time.Instant` | User property used to store the build timestamp. | - | 4.1.0 | User properties | | 28. | `maven.style.color` | `String` | Maven output color mode. Allowed values are auto, always, never. | `auto` | 4.0.0 | User properties | | 29. | `maven.style.debug` | `String` | Color style for debug messages. | `bold,f:cyan` | 4.0.0 | User properties | | 30. | `maven.style.error` | `String` | Color style for error messages. | `bold,f:red` | 4.0.0 | User properties |