Last active
December 25, 2015 13:59
-
-
Save jizhang/6987979 to your computer and use it in GitHub Desktop.
A sample Maven configuration for packaging. I usually use assembly, but when it comes to spring framework, you have to use shade.
This file contains 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
<!-- project / build / plugins/ plugin --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>2.1</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<shadedArtifactAttached>true</shadedArtifactAttached> | |
<createDependencyReducedPom>false</createDependencyReducedPom> | |
<shadedClassifierName>jar-with-dependencies</shadedClassifierName> | |
<transformers> | |
<transformer | |
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<mainClass>com.domain.project.App</mainClass> | |
</transformer> | |
<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> | |
<transformer | |
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> | |
<resource>META-INF/spring.tooling</resource> | |
</transformer> | |
</transformers> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> | |
</descriptorRefs> | |
<archive> | |
<manifest> | |
<mainClass>com.domain.project.App</mainClass> | |
</manifest> | |
</archive> | |
</configuration> | |
<executions> | |
<execution> | |
<id>make-assembly</id> | |
<phase>package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment