You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/22 21:01:59 UTC

(maven-dependency-plugin) 02/02: [MDEP-654] Drop the duplicate snapshot checksum copy and warn without useRepositoryLayout

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git

commit 2ee3bd9bd43f92e5e910746d693e80c71bb478f9
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Wed Oct 14 00:06:41 2026 +0200

    [MDEP-654] Drop the duplicate snapshot checksum copy and warn without useRepositoryLayout
---
 .../fromDependencies/CopyDependenciesMojo.java          | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
index 9002c351..162914fd 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java
@@ -152,6 +152,10 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
      */
     @Override
     protected void doExecute() throws MojoExecutionException {
+        if (copyChecksums && !useRepositoryLayout) {
+            getLog().warn(
+                            "copyChecksums only applies together with useRepositoryLayout, no checksum files are copied.");
+        }
         DependencyStatusSets dss =
                 getDependencySets(this.failOnMissingClassifierArtifact, addParentPoms, addImportedBoms);
         Set<Artifact> artifacts = dss.getResolvedDependencies();
@@ -254,8 +258,9 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
     }
 
     /**
-     * Copies the checksum files next to the artifact in the source local repository to the matching locations in the
-     * target repository layout, for both the artifact version and, for a timestamped snapshot, its base version.
+     * Copies the checksum files next to the artifact in the source local repository to the matching location in the
+     * target repository layout. The local repository manager names a timestamped snapshot by its base version, as
+     * the installed artifact is.
      */
     private void copyChecksumFiles(Artifact artifact, RepositorySystemSession repositorySystemSession) {
         if (!copyChecksums || artifact.getFile() == null) {
@@ -266,14 +271,6 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
         org.eclipse.aether.artifact.Artifact aArtifact = RepositoryUtils.toArtifact(artifact);
         copyChecksumFiles(
                 artifact.getFile(), new File(baseDir, localRepositoryManager.getPathForLocalArtifact(aArtifact)));
-        if (artifact.isSnapshot() && !artifact.getBaseVersion().equals(artifact.getVersion())) {
-            copyChecksumFiles(
-                    artifact.getFile(),
-                    new File(
-                            baseDir,
-                            localRepositoryManager.getPathForLocalArtifact(
-                                    aArtifact.setVersion(artifact.getBaseVersion()))));
-        }
     }
 
     private void copyChecksumFiles(File source, File destination) {