Maven UberjarringPete Kazmier has written the uberjar plugin for maven .
Simply set (in your project.properties) the
maven uberjar An uberjar containing your project's jar and all dependencies will be created for you. Manual Uberjarring
To create a standalone jar (aka, an uberjar), simply build your application's
jar as normal. Gather up all dependent jars and create a
The
[app]
${classworlds.lib}/myApp.jar
${classworlds.lib}/someDependency.jar
The core
Create the required directory structure, and populate it with the appropriate files. For example:
./assembly-dir/
WORLDS-INF/
classworlds.jar
lib/
myApp.jar
someDependency.jar
anotherDependency.jar
conf/
classworlds.conf
All that remains is unjaring the classes from
./assembly-dir/
WORLDS-INF/
classworlds.jar
lib/
myApp.jar
someDependency.jar
anotherDependency.jar
conf/
classworlds.conf
com/
werken/
classworlds/
boot/
Bootstrapper.class
InitialClassLoader.class
protocol/
jar/
Handler.class
JarUrlConnection.class
Now, simply create and distribute your standalone uberjar: cd assembly-dir/ jar cvf myapp-standalone.jar . java -jar myapp-standalone.jar |