Created
September 3, 2012 13:15
-
-
Save stephen-masters/3609269 to your computer and use it in GitHub Desktop.
Maven Shade Plugin example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>1.4</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> | |
<resource>META-INF/spring.handlers</resource> | |
</transformer> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> | |
<resource>META-INF/spring.schemas</resource> | |
</transformer> | |
</transformers> | |
<filters> | |
<filter> | |
<artifact>*:*</artifact> | |
<excludes> | |
<exclude>META-INF/*.SF</exclude> | |
<exclude>META-INF/*.DSA</exclude> | |
<exclude>META-INF/*.RSA</exclude> | |
</excludes> | |
</filter> | |
</filters> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the shade plugin it's relatively simple to have your build create a single Jar file containing all dependencies. This can simplify deployments greatly and avoids the issues that come of having a lib directory on a server containing loads of Jar files, and you have no idea what version each of them is. This way, you ensure that all the dependencies you tested against in your build are definitely the ones that have been deployed with your code.
I find it particularly handy for FitNesse where I'm able to run a quick script to download the latest version of an artifact from a repository, and I know that what I'm getting includes all the dependencies I need. If a dependency version changes, or is added, I don't need to alter my deployment script.