Merge pull request #33350 from StitzL
* pr/33350: Improve log message when repackaging by specifying the involved files Closes gh-33350
This commit is contained in:
commit
db80fc1734
|
@ -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");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue