Deliver Your Java Application in One-JAR™! Copyright 2004-2007 by P. Simon Tuffs, All Rights Reserved.
http://www.simontuffs.com

Build Tools

A One-JAR Archive can be built using only the Java jar tool, if you spend the necessary effort to create a directory tree that follows the required structure. But it is simpler and easier to use one of the build-tools that know how to build a One-JAR archive. There are currently two alternatives.

Ant: The <one-jar> taskdef

The <one-jar> Ant task supports building a One-JAR Archive, creating a main/main.jar from a <main> section, and adding in libraries from a <lib> section. See the following sections in this documentation for details.

Maven

There is a one-jar Maven2 SNAPSHOT plugin available at the following repository:
<pluginRepository>
    <id>onejar-maven-plugin.googlecode.com</id>
    <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo-snapshot</url>
</pluginRepository>
There is a one-jar Maven2 release plugin available at the following repository:
<pluginRepository>
    <id>onejar-maven-plugin.googlecode.com</id>
    <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
</pluginRepository>
The plugin embeds the one-jar-boot-0.97.jar file as a resource. To determine which version of One-JAR the plugin is using, examine the contents of the ".version" file in the embedded one-jar-boot file. Or alternatvely, build a One-JAR archive and run it with the --one-jar-version argument. See the following sections in this documentation for details.