Try something like this:
<?xml version="1.0"?> <project name="blah" basedir="." default="jar"> <target name="init"> <property name="build" value="./build" /> <property name="srcdir" value="./src" /> <property name="lib.dir" value="./lib" /> <property name="dist" value="./dist" /> <property name="docs" value="./docs" /> <property name="debug" value="true" /> <path id="project.class.path"> <pathelement path="${java.class.path}" /> <fileset dir="${lib.dir}"> <include name="*.jar" /> </fileset> </path> </target> <target name="compile" depends="init"> <mkdir dir="${build}" /> <javac debug="${debug}" optimize="${optimize}" destdir="${build}" deprecation="${deprecation}" source="1.6" target="1.6"> <src path="${srcdir}" /> <classpath refid="project.class.path" /> </javac> </target> <target name="jar" depends="compile"> <mkdir dir="${dist}" /> <jar destfile="${dist}/${ant.project.name}.jar"> <fileset dir="${build}"> <include name="com/blah/blah/*.class" /> </fileset> </jar> </target> <target name="package" depends="compile, jar"> <jar destfile="${dist}/${ant.project.name}-release.jar" basedir="${build}" includes="**/*.*"> <manifest> <attribute name="Main-Class" value="com.blah.blah.Main" /> </manifest> <zipgroupfileset dir="${lib.dir}" includes="*.jar" /> <zipgroupfileset dir="${dist}" includes="${ant.project.name}.jar" /> </jar> </target> </project>
Then you will go:
ant package
To create a single jar file with all the classes in the lib folder.
source share