Created
March 24, 2021 02:37
-
-
Save robbystk/9727807ad3d1e765449504b1dcb62551 to your computer and use it in GitHub Desktop.
simple, naive, build.xml that works but is probably not very good in several ways
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 name="keywords"> | |
<property name="main-class" value="com.keywords.Person"/> | |
<property name="lib.dir" value="lib"/> | |
<property name="build.dir" value="bin"/> | |
<property name="app.dir" value="src/main/java"/> | |
<property name="test.dir" value="src/test/java"/> | |
<property name="jar.dir" value="dist"/> | |
<path id="classpath"> | |
<fileset dir="${lib.dir}" includes="**/*.jar"/> | |
</path> | |
<target name="compile"> | |
<mkdir dir="${build.dir}"/> | |
<javac srcdir="${app.dir}" destdir="${build.dir}" classpathref="classpath"/> | |
</target> | |
<target name="jar" depends="compile"> | |
<mkdir dir="${jar.dir}"/> | |
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${build.dir}"> | |
<manifest> | |
<attribute name="Main-Class" value="${main-class}"/> | |
</manifest> | |
</jar> | |
</target> | |
<target name="compile-tests" depends="compile"> | |
<mkdir dir="${build.dir}"/> | |
<javac srcdir="${test.dir}" destdir="${build.dir}" classpathref="classpath"/> | |
</target> | |
<target name="test" depends="compile-tests,jar"> | |
<junit printsummary="yes"> | |
<classpath> | |
<path refid="classpath"/> | |
<pathelement location="${jar.dir}/${ant.project.name}.jar"/> | |
</classpath> | |
<batchtest fork="yes"> | |
<fileset dir="${test.dir}"/> | |
</batchtest> | |
</junit> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment