|
Ant Example.For a more detailed example look a the build.xml file in the One-JAR SDK, available through the Downloads page. The key Ant target to learn from is shown below:<import file="one-jar-ant-task.xml"/> <target name="hello" depends="init"> <!-- Build lib.jar --> <javac destdir="${classes.dir}/lib"> <src path="${lib.dir}" /> </javac> <jar destfile="${build.dir}/lib.jar" > <fileset dir="${classes.dir}/lib"/> </jar> <!-- Build classes for main.jar --> <javac destdir="${classes.dir}/src"> <src path="${src.dir}" /> <classpath path="${build.dir}/lib.jar"/> </javac> <!-- Construct the One-JAR file --> <one-jar destfile="hello.jar" manifest="hello.mf"> <main> <!-- Construct main.jar from classes and source code --> <fileset dir="${classes.dir}/src"/> </main> <lib> <fileset file="${build.dir}/lib.jar" /> </lib> </one-jar> <echo> Now you can run the Hello One-JAR example using $ java -jar hello.jar </echo> </target> |