ant-demo1/build.xml

65 lines
1.8 KiB
XML

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ant_demo1" default="run">
<property name="dist" location="target" />
<property name="src" location="src" />
<property name="srcJava" location="${src}/main/java" />
<property name="libs" location="lib/" />
<target name="resolve-ivy-deps" description="Resolving dependencies">
<ivy:retrieve />
</target>
<target name="download-ivy" description="Download ivy">
<mkdir dir="${user.home}/.ant/lib" />
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.5.0/ivy-2.5.0.jar"
dest="${user.home}/.ant/lib/"
verbose="off"
quiet="true" />
</target>
<target name="init" description="init build" depends="download-ivy" />
<target name="deps" depends="resolve-ivy-deps" />
<target name="copy-resources">
<mkdir dir="${dist}/exploded" />
<copy toDir="${dist}/exploded">
<fileset dir="${src}/main/resources/" />
<dirset dir="${src}/main/resources/" />
</copy>
</target>
<target name="compile-classes">
<mkdir dir="${dist}/classes" />
<javac srcdir="${srcJava}" destdir="${dist}/classes" />
<copy toDir="${dist}/exploded">
<fileset dir="${dist}/classes/" />
<dirset dir="${dist}/classes/" />
</copy>
</target>
<target name="package-jar">
<jar basedir="${dist}/exploded"
destfile="${dist}/libs/lib.jar"
filesetmanifest="merge" />
</target>
<target name="build"
description="build">
<antcall target="deps" />
<antcall target="copy-resources" />
<antcall target="compile-classes" />
<antcall target="package-jar" />
</target>
<target name="clean" description="clean">
<delete dir="${dist}" />
</target>
<target name="run" description="default runner" depends="build" />
</project>