www.scmGalaxy.com
<?xml version="1.0"?>
<project name="test" default="compile" basedir=".">
<property name="src" value="."/>
<property name="build" value="build"/>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<!-- Compile the java code -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
</project>
<?xml version="1.0"?>
XML declaration specifying version of XML used.
All XML constraints hold good for build.xml
<project name= "test" default="compile" basedir=".">
<property name="src" value="."/>
<property name="build" value="build"/>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
-help | print this message |
-projecthelp | print project help information |
-version | print the version information and exit |
-diagnostics | print information that might be helpful to diagnose or report problems. |
-quiet, -q | be extra quiet |
-verbose, -v | be extra verbose |
-debug | print debugging information |
-emacs | produce logging information without adornments |
-logfile <file> | use given file for log |
-l <file> | "" |
-logger <classname> | the class which is to perform logging |
-listener <classname> | add an instance of class as a project listener |
-buildfile <file> | use given buildfile |
-file <file> | "" |
-f <file> | "" |
-D<property>=<value> | use value for given property |
-propertyfile | taking precedence |
-inputhandler <class> | the class which will handle input requests |
-find <file> <name> | load all properties from file with -D properties search for buildfile towards the root of the filesystem and use it |
- classpath
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="lib/helper.jar"/>
</classpath>
<classpath path ="${classpath}"/>
- path
<path id="project.class.path">
<path refid="base.path"/>
<pathelement location="lib/"/>
</path>
<classpath refid="project.class.path"/>
To use the same path-like structure for several tasks, you can define them with a <path> element at the same level as targets, and reference them via their id attribute
- dirset, fileset,filelist
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<filelist dir="${src.dir}" files="foo.xml,bar.xml"/>
</classpath>
<javac debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
destdir="${build.dest}"
includes="com/**" excludes="**/*.xml">
<src path="${src.dir}" />
<classpath refid="classpath" />
</javac>
- ant
<ant antfile="subproject/subbuild.xml"
dir="subproject"
target="compile"/>
<ant inheritAll="false"
antfile="subproject/subbuild.xml">
<property name="output.type" value="html"/>
</ant>
- antcall
<target name="default">
<antcall target="doSomethingElse">
<param name="param1" value="value"/>
</antcall>
</target>
<target name="doSomethingElse">
<echo message="param1=${param1}"/>
</target>
Author: Rajesh Kumar
rajeshkumar.raj06@gmail.com