diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/pom.xml b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/pom.xml new file mode 100644 index 0000000000..114538f88e --- /dev/null +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + org.springframework.boot.maven.it + jar-skip + 0.0.1.BUILD-SNAPSHOT + + UTF-8 + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + repackage + + + true + + + + + + + + diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/verify.groovy b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/verify.groovy new file mode 100644 index 0000000000..2c2efb7d22 --- /dev/null +++ b/spring-boot-tools/spring-boot-maven-plugin/src/it/jar-skip/verify.groovy @@ -0,0 +1,7 @@ +import static org.junit.Assert.assertTrue +import static org.junit.Assert.assertFalse + +File f = new File( basedir, "target/jar-skip-0.0.1.BUILD-SNAPSHOT.jar") +assertTrue 'output file should have been generated', f.exists() +File shouldNotExist = new File( basedir, "target/jar-skip-0.0.1.BUILD-SNAPSHOT.jar.original") +assertFalse 'repackage goal should not have run. .original should not exist', shouldNotExist.exists() diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index 0bfd9edacb..6edd33a36c 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -81,6 +81,13 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { @Parameter(defaultValue = "${project.build.finalName}", required = true) private String finalName; + /** + * Skip the execution. + * @since 1.Z + */ + @Parameter(property = "skip", defaultValue = "false") + private boolean skip; + /** * Classifier to add to the artifact generated. If given, the artifact will be * attached. If this is not given, it will merely be written to the output directory @@ -123,6 +130,10 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { getLog().debug("repackage goal could not be applied to pom project."); return; } + if (this.skip) { + getLog().debug("skipping repackaging as per configuration."); + return; + } File source = this.project.getArtifact().getFile(); File target = getTargetFile();