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 d57a0576a4329739c119988207695472a5774465
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sun Oct 18 19:38:14 2026 +0200

    [MDEP-654] Always copy checksum files with useRepositoryLayout
---
 src/it/projects/mdep-654-copy-checksums/pom.xml          |  6 +++---
 src/it/projects/mdep-654-copy-checksums/verify.groovy    |  4 ++--
 .../fromDependencies/CopyDependenciesMojo.java           | 16 +---------------
 .../fromDependencies/TestCopyDependenciesMojo2.java      | 11 +++++------
 4 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/src/it/projects/mdep-654-copy-checksums/pom.xml 
b/src/it/projects/mdep-654-copy-checksums/pom.xml
index 365bda74..46c1cfd1 100644
--- a/src/it/projects/mdep-654-copy-checksums/pom.xml
+++ b/src/it/projects/mdep-654-copy-checksums/pom.xml
@@ -23,7 +23,7 @@ under the License.
   <artifactId>mdep-654</artifactId>
   <version>1.0</version>
   <description>
-    MDEP-654: copy-dependencies with useRepositoryLayout and copyChecksums 
also copies the checksum files
+    MDEP-654: copy-dependencies with useRepositoryLayout also copies the 
checksum files
     that sit next to each artifact and POM in the local repository.
   </description>
   <dependencies>
@@ -40,7 +40,6 @@ under the License.
         <artifactId>maven-dependency-plugin</artifactId>
         <version>@project.version@</version>
         <configuration>
-          <useRepositoryLayout>true</useRepositoryLayout>
           <copyPom>true</copyPom>
         </configuration>
         <executions>
@@ -51,6 +50,7 @@ under the License.
             </goals>
             <configuration>
               
<outputDirectory>${project.build.directory}/without-checksums</outputDirectory>
+              <useRepositoryLayout>false</useRepositoryLayout>
             </configuration>
           </execution>
           <execution>
@@ -60,7 +60,7 @@ under the License.
             </goals>
             <configuration>
               
<outputDirectory>${project.build.directory}/with-checksums</outputDirectory>
-              <copyChecksums>true</copyChecksums>
+              <useRepositoryLayout>true</useRepositoryLayout>
             </configuration>
           </execution>
         </executions>
diff --git a/src/it/projects/mdep-654-copy-checksums/verify.groovy 
b/src/it/projects/mdep-654-copy-checksums/verify.groovy
index bc9df236..cc554d46 100644
--- a/src/it/projects/mdep-654-copy-checksums/verify.groovy
+++ b/src/it/projects/mdep-654-copy-checksums/verify.groovy
@@ -17,13 +17,13 @@
  * under the License.
  */
 
-// MDEP-654: checksum files from the local repository are copied only when 
copyChecksums is set.
+// MDEP-654: with useRepositoryLayout, the checksum files from the local 
repository are copied too.
 def relative = 'org/apache/maven/its/dependency/mdep654-dep/1.0'
 def localRepo = new File(localRepositoryPath, relative)
 assert new File(localRepo, 'mdep654-dep-1.0.jar.sha1').isFile() : "No jar 
checksum in the local repository ${localRepo}"
 
 def withDir = new File(basedir, "target/with-checksums/${relative}")
-def withoutDir = new File(basedir, "target/without-checksums/${relative}")
+def withoutDir = new File(basedir, "target/without-checksums")
 ['mdep654-dep-1.0.jar', 'mdep654-dep-1.0.pom'].each { name ->
     assert new File(withDir, name).isFile()
     assert new File(withoutDir, name).isFile()
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 162914fd..e3387584 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
@@ -115,16 +115,6 @@ public class CopyDependenciesMojo extends 
AbstractFromDependenciesMojo {
     @Parameter(property = "mdep.copySignatures", defaultValue = "false")
     protected boolean copySignatures;
 
-    /**
-     * Also copy the checksum files ({@code .sha1}, {@code .md5}, {@code 
.sha256} and {@code .sha512}) that sit next
-     * to each artifact and its POM in the local repository. Only used 
together with {@link #useRepositoryLayout};
-     * checksum files that do not exist in the local repository are skipped.
-     *
-     * @since 3.12.0
-     */
-    @Parameter(property = "mdep.copyChecksums", defaultValue = "false")
-    protected boolean copyChecksums;
-
     @Inject
     public CopyDependenciesMojo(
             MavenSession session,
@@ -152,10 +142,6 @@ 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();
@@ -263,7 +249,7 @@ public class CopyDependenciesMojo extends 
AbstractFromDependenciesMojo {
      * the installed artifact is.
      */
     private void copyChecksumFiles(Artifact artifact, RepositorySystemSession 
repositorySystemSession) {
-        if (!copyChecksums || artifact.getFile() == null) {
+        if (artifact.getFile() == null) {
             return;
         }
         LocalRepositoryManager localRepositoryManager = 
repositorySystemSession.getLocalRepositoryManager();
diff --git 
a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
 
b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
index 0735582d..3d40e5f8 100644
--- 
a/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
+++ 
b/src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo2.java
@@ -316,7 +316,6 @@ class TestCopyDependenciesMojo2 {
 
     @Test
     @InjectMojo(goal = "copy-dependencies")
-    @MojoParameter(name = "copyChecksums", value = "true")
     void testRepositoryLayoutCopiesChecksums(CopyDependenciesMojo mojo) throws 
Exception {
         Artifact artifact = stubFactory.createArtifact(
                 "testGroupId",
@@ -394,7 +393,7 @@ class TestCopyDependenciesMojo2 {
 
     @Test
     @InjectMojo(goal = "copy-dependencies")
-    void testRepositoryLayoutSkipsChecksumsByDefault(CopyDependenciesMojo 
mojo) throws Exception {
+    void testFlatLayoutDoesNotCopyChecksums(CopyDependenciesMojo mojo) throws 
Exception {
         Artifact artifact = stubFactory.createArtifact(
                 "testGroupId",
                 "artifact-without-checksums",
@@ -408,12 +407,12 @@ class TestCopyDependenciesMojo2 {
                 "sha1-value".getBytes(StandardCharsets.UTF_8));
         mojo.getProject().setArtifacts(Collections.singleton(artifact));
 
-        mojo.useRepositoryLayout = true;
+        mojo.useRepositoryLayout = false;
         mojo.execute();
 
-        Path artifactDirectory = 
mojo.outputDirectory.toPath().resolve("testGroupId/artifact-without-checksums/1.0");
-        
assertTrue(Files.isRegularFile(artifactDirectory.resolve("artifact-without-checksums-1.0.jar")));
-        
assertFalse(Files.exists(artifactDirectory.resolve("artifact-without-checksums-1.0.jar.sha1")));
+        Path outputDirectory = mojo.outputDirectory.toPath();
+        
assertTrue(Files.isRegularFile(outputDirectory.resolve("artifact-without-checksums-1.0.jar")));
+        
assertFalse(Files.exists(outputDirectory.resolve("artifact-without-checksums-1.0.jar.sha1")));
     }
 
     private Artifact createExpandedVersionArtifact(

Reply via email to