Académique Documents
Professionnel Documents
Culture Documents
com
www.scmGalaxy.com
Contents
Introduction
How does ANT work ?
Sample Build file
Built-in properties
ANT – Different flows
Writing your own task
Command-line options
IDE Integration
References
www.scmGalaxy.com
www.scmGalaxy.com
Introduction
What Is Ant?
ü A build tool like ‘make’
ü Open source
ü – from the Apache Jakarta project
ü – http://ant.apache.org/
ü Implemented in Java
ü Used to build many open source products
www.scmGalaxy.com
www.scmGalaxy.com
Introduction ..contd
ü Ease of use
– Ant is extended using Java classes
– The configuration files are XML-based, calling out a target
tree where various tasks get executed
– Same config file (build.xml) can be across multiple platorms
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
Built-in Properties
ü Ant provides access to all system properties
and also has some additional properties.
basedir The absolute path of the project's basedir
(as set with the basedir attribute of
<project>).
ant.file The absolute path of the buildfile.
ant.version The version of Ant
ant.project.name The name of the project that is currently
executing; it is set in the name attribute
of <project>.
ant.java.version the JVM version Ant detected;
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
<!-- Compile the java code from ${src} into ${build} -->
</target>
www.scmGalaxy.com
www.scmGalaxy.com
Calling different targets in the same build.xml (very similar to calling functions in regular programming language)
Eg :
<antcall target="copymodule">
</antcall>
<fileset dir="${gws.class.folder}">
<patternset>
<include name="**/${module.name}/**"/>
</patternset>
</fileset>
</copy>
</target>
www.scmGalaxy.com
www.scmGalaxy.com
</target>
<target name="examples">
</target> www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
4. Write a public void execute method, with no arguments, that throws a BuildException
1. Make sure the class that implements your task is in the classpath when starting Ant.
2. Add a <taskdef> element to your project. This actually adds your task to the system.
3. Use your task in the rest of the buildfile
6. Eg:
<?xml version="1.0"?>
<target name="main">
</target>
</project>
www.scmGalaxy.com
www.scmGalaxy.com
Options:
-l <file> ''
-f <file> ''
www.scmGalaxy.com
-find <file> <name> load all properties from file with -D properties search for buildfile towards the
root of the filesystem and use it
www.scmGalaxy.com
IDE Integration
ü Ant can be integrated with the following Java
IDEs
– Jbuilder
– IntelliJ Idea
– Eclipse
ü See the Ant User Manual for more details
– in http://ant.apache.org/manual/index.html
www.scmGalaxy.com
www.scmGalaxy.com
References
Home – http://ant.apache.org/
FAQ – http://ant.apache.org/faq.html
Mailing Lists
http://marc.theaimsgroup.com/?l=ant-user&r=1&w=2
http://archives.apache.org/eyebrowse/SummarizeList?listId=5
Books
Related Projects :
Maven - http://jakarta.apache.org/turbine/maven/
Centipede - http://www.krysalis.org/centipede/
AntHill - http://www.urbancode.com/projects/anthill/default.jsp
CruiseControl - http://cruisecontrol.sourceforge.net/
www.scmGalaxy.com
www.scmGalaxy.com
www.scmGalaxy.com
Thank You !
www.scmGalaxy.com