Provide better logging for RepackageMojo

Closes gh-15294
This commit is contained in:
Stephane Nicoll
2018-11-26 17:12:58 +01:00
parent 9331390079
commit d7fe3c73a3
14 changed files with 280 additions and 54 deletions

View File

@@ -336,14 +336,21 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
attachArtifact(source, target);
}
else if (source.getFile().equals(target)) {
getLog().info("Updating artifact " + source.getFile() + " to " + original);
this.project.getArtifact().setFile(original);
String artifactId = (this.classifier != null)
? "artifact with classifier " + this.classifier : "main artifact";
getLog().info(String.format("Updating %s %s to %s", artifactId,
source.getFile(), original));
source.setFile(original);
}
else if (this.classifier != null) {
getLog().info("Creating repackaged archive " + target + " with classifier "
+ this.classifier);
}
}
private void attachArtifact(Artifact source, File target) {
if (this.classifier != null && !source.getFile().equals(target)) {
getLog().info("Attaching archive " + target + " with classifier "
getLog().info("Attaching repackaged archive " + target + " with classifier "
+ this.classifier);
this.projectHelper.attachArtifact(this.project, this.project.getPackaging(),
this.classifier, target);
@@ -351,7 +358,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
else {
String artifactId = (this.classifier != null)
? "artifact with classifier " + this.classifier : "main artifact";
getLog().info(String.format("Replacing %s %s", artifactId, source.getFile()));
getLog().info("Replacing " + artifactId + " with repackaged archive");
source.setFile(target);
}
}