Created
November 16, 2013 03:36
-
-
Save whymarrh/7495604 to your computer and use it in GitHub Desktop.
Simple Ant build file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Directory structure: | |
. | |
├── build.xml | |
├── libs | |
└── src | |
└── foo | |
└── bar | |
└── baz | |
└── qux | |
--> | |
<project name="Foobar" default="cleanrun" basedir="."> | |
<!-- Set global properties --> | |
<property name="srcdir" location="src" /> | |
<property name="libs" location="libs" /> | |
<property name="dist" location="dist" /> | |
<property name="build" location="build" /> | |
<path id="libs"> | |
<fileset dir="${libs}"> | |
<include name="**/*.jar" /> | |
</fileset> | |
</path> | |
<target name="init"> | |
<tstamp /> | |
<mkdir dir="${build}" /> | |
<mkdir dir="${dist}" /> | |
</target> | |
<!-- Compile all the things --> | |
<target name="compile" depends="init" description="Compile all the Java files and put them into a JAR."> | |
<javac includeantruntime="false" srcdir="${srcdir}" destdir="${build}" debug="true"> | |
<classpath refid="libs" /> | |
<compilerarg value="-Xlint:all" /> | |
</javac> | |
<jar jarfile="${dist}/${ant.project.name}-${DSTAMP}.jar" basedir="${build}"> | |
<zipgroupfileset dir="${libs}" includes="**/*.jar" /> | |
<manifest> | |
<attribute name="Main-Class" value="foo.bar.baz.qux.MainClassName" /> | |
</manifest> | |
</jar> | |
</target> | |
<target name="cleanrun" depends="compile" description="Run the compiled JAR file."> | |
<delete dir="${build}" /> | |
<java jar="${dist}/${ant.project.name}-${DSTAMP}.jar" fork="true" /> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment