|
|
@@ -223,9 +223,11 @@ ant.java.version the JVM version Ant detected; currently it can hold |
|
|
|
<a name="example"><h3>Example Buildfile</h3></a> |
|
|
|
<pre> |
|
|
|
<project name="MyProject" default="dist" basedir="."> |
|
|
|
|
|
|
|
<description> |
|
|
|
simple example build file |
|
|
|
</description> |
|
|
|
<!-- set global properties for this build --> |
|
|
|
<property name="src" value="."/> |
|
|
|
<property name="src" value="src"/> |
|
|
|
<property name="build" value="build"/> |
|
|
|
<property name="dist" value="dist"/> |
|
|
|
|
|
|
@@ -236,12 +238,14 @@ ant.java.version the JVM version Ant detected; currently it can hold |
|
|
|
<mkdir dir="${build}"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="compile" depends="init"> |
|
|
|
<target name="compile" depends="init" |
|
|
|
description="compile the source " > |
|
|
|
<!-- Compile the java code from ${src} into ${build} --> |
|
|
|
<javac srcdir="${src}" destdir="${build}"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="dist" depends="compile"> |
|
|
|
<target name="dist" depends="compile" |
|
|
|
description="generate the distribution" > |
|
|
|
<!-- Create the distribution directory --> |
|
|
|
<mkdir dir="${dist}/lib"/> |
|
|
|
|
|
|
@@ -249,7 +253,8 @@ ant.java.version the JVM version Ant detected; currently it can hold |
|
|
|
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="clean"> |
|
|
|
<target name="clean" |
|
|
|
description="clean up" > |
|
|
|
<!-- Delete the ${build} and ${dist} directory trees --> |
|
|
|
<delete dir="${build}"/> |
|
|
|
<delete dir="${dist}"/> |
|
|
@@ -257,6 +262,21 @@ ant.java.version the JVM version Ant detected; currently it can hold |
|
|
|
</project> |
|
|
|
</pre> |
|
|
|
|
|
|
|
Notice that we are declaring properties outside any target. The |
|
|
|
<tt><property></tt>,<tt><path></tt> and <tt><taskdef></tt> |
|
|
|
tasks are special in that they can be declared outside any target. When you |
|
|
|
do this they are evaluated before any targets are executed. No other tasks |
|
|
|
can be declared outside targets. |
|
|
|
|
|
|
|
<p> |
|
|
|
We have given some targets descriptions; this causes the <tt>projecthelp</tt> |
|
|
|
invocation option to list them as public targets with the descriptions; the |
|
|
|
other target is internal and not listed. |
|
|
|
<p> |
|
|
|
Finally, for this target to work the source in the <tt>src</tt> subdirectory |
|
|
|
should be stored in a directory tree which matches the package names. Check the |
|
|
|
<tt><javac></tt> task for details. |
|
|
|
|
|
|
|
<a name="filters"><h3>Token Filters</h3></a> |
|
|
|
<p>A project can have a set of tokens that might be automatically expanded if |
|
|
|
found when a file is copied, when the filtering-copy behavior is selected in the |
|
|
|