Last active
October 17, 2016 11:53
-
-
Save paretje/b015e1186857f2df01983ab4f2dcfbdd to your computer and use it in GitHub Desktop.
Basic 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
<project default="jar"> | |
<property file="project.properties" prefix="project" /> | |
<target name="clean"> | |
<delete dir="build" /> | |
</target> | |
<target name="compile"> | |
<mkdir dir="build/classes" /> | |
<javac includeantruntime="false" srcdir="src" destdir="build/classes" classpath="${project.classpath}" /> | |
</target> | |
<target name="jar" depends="compile"> | |
<mkdir dir="build/jar"/> | |
<jar destfile="build/jar/${project.name}.jar" basedir="build/classes"> | |
<manifest> | |
<attribute name="Main-Class" value="${project.main}" /> | |
</manifest> | |
</jar> | |
</target> | |
<target name="run" depends="compile"> | |
<java classpath="build/classes:${project.classpath}" classname="${project.main}" fork="true" /> | |
</target> | |
<target name="debug"> | |
<mkdir dir="build/debug"/> | |
<javac includeantruntime="false" srcdir="src" destdir="build/debug" classpath="build/classes:${project.classpath}" debug="true" /> | |
</target> | |
<target name="compile-tests" depends="debug"> | |
<mkdir dir="build/test"/> | |
<javac includeantruntime="false" srcdir="test" destdir="build/test" classpath="/usr/share/java/junit4.jar:build/debug:${project.classpath}" debug="true" /> | |
</target> | |
<target name="test" depends="compile-tests"> | |
<junit fork="yes" haltonfailure="yes"> | |
<classpath> | |
<pathelement location="build/debug" /> | |
<pathelement location="build/test" /> | |
<pathelement location="/usr/share/java/junit4.jar" /> | |
<pathelement path="${project.classpath}" /> | |
</classpath> | |
<batchtest> | |
<fileset dir="build/test"> | |
<include name="**/*Test*" /> | |
</fileset> | |
</batchtest> | |
<formatter type="brief" usefile="false" /> | |
</junit> | |
</target> | |
<target name="test-file" depends="compile-tests"> | |
<java classpath="/usr/share/java/junit4.jar:build/debug:build/test:${project.classpath}" classname="org.junit.runner.JUnitCore" fork="true"> | |
<arg value="${test}" /> | |
</java> | |
</target> | |
</project> |
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
name=project | |
main=Main | |
classpath= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment