diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java index de5e91023df..99566301f98 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java @@ -65,7 +65,9 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests { .hasEntryWithNameStartingWith("BOOT-INF/lib/jakarta.servlet-api-6") .hasEntryWithName("BOOT-INF/classes/org/test/SampleApplication.class") .hasEntryWithName("org/springframework/boot/loader/JarLauncher.class"); - assertThat(buildLog(project)).contains("Replacing main artifact with repackaged archive") + assertThat(buildLog(project)) + .contains("Replacing main artifact " + repackaged + " with repackaged archive,") + .contains("The original artifact has been renamed to " + original) .contains("Installing " + repackaged + " to").doesNotContain("Installing " + original + " to"); }); } @@ -107,7 +109,9 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests { assertThat(original).isFile(); File repackaged = new File(project, "target/jar-classifier-source-0.0.1.BUILD-SNAPSHOT-test.jar"); assertThat(jar(repackaged)).hasEntryWithNameStartingWith("BOOT-INF/classes/"); - assertThat(buildLog(project)).contains("Replacing artifact with classifier test with repackaged archive") + assertThat(buildLog(project)) + .contains("Replacing artifact with classifier test " + repackaged + " with repackaged archive,") + .contains("The original artifact has been renamed to " + original) .doesNotContain("Installing " + original + " to").contains("Installing " + repackaged + " to"); }); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index 03364c4561d..d1772896cd0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -279,7 +279,7 @@ public class RepackageMojo extends AbstractPackagerMojo { private void updateArtifact(Artifact source, File target, File original) { if (this.attach) { - attachArtifact(source, target); + attachArtifact(source, target, original); } else if (source.getFile().equals(target) && original.exists()) { String artifactId = (this.classifier != null) ? "artifact with classifier " + this.classifier @@ -292,7 +292,7 @@ public class RepackageMojo extends AbstractPackagerMojo { } } - private void attachArtifact(Artifact source, File target) { + private void attachArtifact(Artifact source, File target, File original) { if (this.classifier != null && !source.getFile().equals(target)) { getLog().info("Attaching repackaged archive " + target + " with classifier " + this.classifier); this.projectHelper.attachArtifact(this.project, this.project.getPackaging(), this.classifier, target); @@ -300,7 +300,10 @@ public class RepackageMojo extends AbstractPackagerMojo { else { String artifactId = (this.classifier != null) ? "artifact with classifier " + this.classifier : "main artifact"; - getLog().info("Replacing " + artifactId + " with repackaged archive"); + getLog().info( + String.format("Replacing %s %s with repackaged archive, adding nested dependencies in BOOT-INF/.", + artifactId, source.getFile())); + getLog().info("The original artifact has been renamed to " + original); source.setFile(target); } }