By default maven is generating a small JAR file, which just contains your compiled classes and other project files. If you want to have a single JAR file which also includes all dependent JAR files, you have to create a uber JAR. You can do that with the maven shade plugin. Just put this lines of xml into your pom.xml.
</pre> <build> <plugins> <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> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>all</shadedClassifierName> </configuration> </execution> </executions> </plugin> </plugins> </build> <pre>
In Maven you can solve every problem. You just need enough XML code for that. If you still have problems, than probably your pom.xml is to short. 🙂
4 thoughts on “Uber JAR with Maven”
Thanks. Please add a note that the configuration section means that a second war file is created with a suffix of ‘-all’.
It’s great your article helped me a lot.
David I do not understand your answer, you can explain more clearly.Please