Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Deprecation Warning

This plugin has been removed from the current Maven distribution, it is not maintained by the Maven team anymore. Please check the Plugins History page to find out the last Maven version that included this plugin.

Maven UberJar Plug-in

UberJar packages your project as well as its dependencies into a single JAR file. In addition, bootstrap code is added to the archive that enables a main class to be invoked by simply typing: java -jar uber.jar. This enables you to easily package up a command line utility into a single JAR without worrying about the distribution of your dependencies or shell scripts to invoke your main class. UberJar takes care of this for you.

UberJar utilizes the Classworlds package for the bootstrap code that loads your dependencies and executes your main method. It also enables your dependent JARs to be inserted into the classpath, and best of all, the JARs are located with the UberJar. JARs within JARs are supported by the Classworlds class loaders. However, you do not need to know anything about Classworlds to build your UberJar. For those that want more information, see the Classworlds uberjar page .

To create the UberJar, be sure to define the maven.uberjar.main property in your project's properties file. Alternatively, if you already have a custom Classworlds configuration file, specify the maven.uberjar.classworlds.conf property instead. To create the UberJar, type:

        maven uberjar

Upon success, the UberJar will be located in your target directory with a -uber appended for identification. To invoke your application, type:

        java -jar your_uber_jar_here.jar