Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file?
I have a project the builds into a single jar file. I want the classes fro
With Maven 2, the right way to do this is to use the Maven2 Assembly Plugin which has a pre-defined descriptor file for this purpose and that you could just use on the command line:
mvn assembly:assembly -DdescriptorId=jar-with-dependencies
If you want to make this jar executable, just add the main class to be run to the plugin configuration:
org.apache.maven.plugins
maven-assembly-plugin
my.package.to.my.MainClass
If you want to create that assembly as part of the normal build process, you should bind the single or directory-single goal (the assembly
goal should ONLY be run from the command line) to a lifecycle phase (package
makes sense), something like this:
org.apache.maven.plugins
maven-assembly-plugin
create-my-bundle
package
single
jar-with-dependencies
...
Adapt the configuration
element to suit your needs (for example with the manifest stuff as spoken).