Disable attach of repackaged artifact

This commit allows to generate the packaged artifact only locally by
adding a new `attach` property. If `attach` is set to `false` explicitly,
only the main artifact is installed/deployed.

Closes gh-5258
This commit is contained in:
Stephane Nicoll
2016-03-01 11:12:59 +01:00
parent 2ecb33f7b4
commit 7f3ee2e405
9 changed files with 194 additions and 13 deletions

View File

@@ -37,6 +37,7 @@ import org.springframework.lang.UsesJava8;
*
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll
*/
public class Repackager {
@@ -140,8 +141,7 @@ public class Repackager {
destination = destination.getAbsoluteFile();
File workingSource = this.source;
if (this.source.equals(destination)) {
workingSource = new File(this.source.getParentFile(),
this.source.getName() + ".original");
workingSource = getBackupFile();
workingSource.delete();
renameFile(this.source, workingSource);
}
@@ -162,6 +162,15 @@ public class Repackager {
}
}
/**
* Return the {@link File} to use to backup the original source.
* @return the file to use to backup the original source
*/
public File getBackupFile() {
return new File(this.source.getParentFile(),
this.source.getName() + ".original");
}
private boolean alreadyRepackaged() throws IOException {
JarFile jarFile = new JarFile(this.source);
try {