Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Maven Shade Plugin example
<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>
@gratiartis

This comment has been minimized.

Copy link
Owner Author

@gratiartis gratiartis commented Nov 16, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.