Add skip parameter to repackage goal

This commit adds a 'skip' parameter to the 'repackage' goal that is
false by default. When this parameter is enabled, the repackage goal
does not run at all.

This can be used when repackaging should occur conditionally or
when a particular module in a hierarchy should not use this feature.

Fixes gh-1424
This commit is contained in:
Stephane Nicoll
2014-08-23 10:02:08 +02:00
parent 8c030795c2
commit d1f4fd0ecb
3 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId>
<artifactId>jar-skip</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- There is no main class on purpose as we skip the whole execution so it shouldn't be necessary -->
<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -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()