Skip to content

Instantly share code, notes, and snippets.

@tonfever
Last active August 29, 2015 14:01
Show Gist options
  • Save tonfever/1be7731d236265959330 to your computer and use it in GitHub Desktop.
Save tonfever/1be7731d236265959330 to your computer and use it in GitHub Desktop.
Ant File example, clean, prepare, compile ,jar
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create_run_jar" name="Create Runnable Jar for Project FreeMarkerTester with libraries in sub-folder">
<!--this file was created by Eclipse Runnable JAR Export Wizard-->
<!--ANT 1.7 is required -->
<property name="dist.home" value="${basedir}/dist" />
<property name="src.home" value="${basedir}/src" />
<property name="bin.home" value="${basedir}/bin" />
<!-- Define the CLASSPATH -->
<path id="compile.classpath">
<fileset dir="${basedir}/bin">
<include name="*.jar" />
</fileset>
</path>
<target name="clean" description="Delete old work and dist directories">
<delete dir="${dist.home}" />
</target>
<target name="prepare" depends="clean" description="Create working dirs and copy static files to work dir">
<mkdir dir="${dist.home}" />
</target>
<target name="compile" depends="prepare" description="Compile Java sources">
<javac srcdir="${src.home}" destdir="${bin.home}">
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="create_run_jar" depends="compile">
<jar destfile="YOURJAR">
<manifest>
<attribute name="Main-Class" value="${MAIN CLASS}" />
<attribute name="Class-Path" value=". lib/freemarker.jar" />
</manifest>
<fileset dir="${bin.home}" />
</jar>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment