Be more lenient when repackage is invoked several times
This commit makes the repackager more lenient when it is invoked several times in the same lifecycle. Closes gh-15034
This commit is contained in:
@@ -179,11 +179,11 @@ public class Repackager {
|
||||
if (this.layout == null) {
|
||||
this.layout = getLayoutFactory().getLayout(this.source);
|
||||
}
|
||||
if (alreadyRepackaged()) {
|
||||
return;
|
||||
}
|
||||
destination = destination.getAbsoluteFile();
|
||||
File workingSource = this.source;
|
||||
if (alreadyRepackaged() && this.source.equals(destination)) {
|
||||
return;
|
||||
}
|
||||
if (this.source.equals(destination)) {
|
||||
workingSource = getBackupFile();
|
||||
workingSource.delete();
|
||||
|
||||
@@ -245,7 +245,9 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
private Artifact getArtifact(String classifier) {
|
||||
if (classifier != null) {
|
||||
for (Artifact attachedArtifact : this.project.getAttachedArtifacts()) {
|
||||
if (classifier.equals(attachedArtifact.getClassifier())) {
|
||||
if (classifier.equals(attachedArtifact.getClassifier())
|
||||
&& attachedArtifact.getFile() != null
|
||||
&& attachedArtifact.getFile().isFile()) {
|
||||
return attachedArtifact;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +337,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
|
||||
if (this.attach) {
|
||||
attachArtifact(source, target);
|
||||
}
|
||||
else if (source.getFile().equals(target)) {
|
||||
else if (source.getFile().equals(target) && original.exists()) {
|
||||
String artifactId = (this.classifier != null)
|
||||
? "artifact with classifier " + this.classifier : "main artifact";
|
||||
getLog().info(String.format("Updating %s %s to %s", artifactId,
|
||||
|
||||
Reference in New Issue
Block a user