jarrodhroberson
2/14/2014 - 3:30 AM

How to bundle Java programs into a single executable .jar file using Ant

How to bundle Java programs into a single executable .jar file using Ant

<target name="build-jar" depends="compile">
    <jar destfile="${dist.dir}/app.jar" compress="true">
        <manifest>
            <attribute name="Main-Class" value="main"/>
        </manifest>
        <fileset dir="${build.dir}/classes" includes="**/*.class"/>
        <zipgroupfileset dir="${lib.dir}">
            <includesfile name="dependencies.list"/>
        </zipgroupfileset>
    </jar>
</target>