Presentation is loading. Please wait.

Presentation is loading. Please wait.

SG Introduction to ANT scmGalaxy Author: Rajesh Kumar

Similar presentations


Presentation on theme: "SG Introduction to ANT scmGalaxy Author: Rajesh Kumar"— Presentation transcript:

1 sG Introduction to ANT www.scmGalaxy.com scmGalaxy Author: Rajesh Kumar info@scmGalaxy.com

2 www.scmGalaxy.com scmGalaxy Agenda  What is Ant?  Why is it called ANT?  Advantages of ANT  How does ANT work?  Sample Build file  Executing An Ant Script  Some Simple Ant Commands  References

3 www.scmGalaxy.com scmGalaxy What is Ant? A build tool Open Source Part of Apache’s Jakarta project. Implemented in Java Written for Java Used to build many open-source Java projects

4 www.scmGalaxy.com scmGalaxy According to the author (James Duncan Davidson)… Because ants do an extremely good job of building things. Stands for “Another Neat Tool” Why is it called ANT?

5 www.scmGalaxy.com scmGalaxy Advantages of ANT Only requires a Java VM to use. It is extended using Java classes, which makes it almost like fun for Java developers. Easier to do Java-specific tasks, such as JavaDocs, WAR and JAR files, and Enterprise JavaBeans. Instead of writing cryptic shell commands, the configuration files are easy to read XML. Each “task” is defined in a separate XML block, making adding or removing additional tasks easier.

6 www.scmGalaxy.com scmGalaxy Advantages Continued It’s FAST! (Uses the same VM for entire process) Because it is Java based, it is easily expandable, and inherently cross-platform. All of the cool Java IDEs have built-in support for Ant. It can easily operate recursively, so only one Ant build script is required for most projects. Ant has built-in CVS support. Ant has built-in FTP support. Ant has built-in JUnit support.

7 www.scmGalaxy.com scmGalaxy How does ANT work?  Ant commands (or tasks) are implemented by Java classes  many tasks are in-built or come in JAR files  custom commands can be easily created  Each project using Ant will have a build file  called build.xml – Ant’s default  Each build file is composed of any number of targets  corresponding to common activities like compiling and running code

8 www.scmGalaxy.com scmGalaxy How does ANT work? (contd)  Each target is composed of tasks  executed in sequence when the target is executed  Ant targets can have dependencies for example, the build file may have a task to run file C, and can specify that before the file C can be run, package B needs to be compiled, and before package B is compiled, package A must be compiled.

9 www.scmGalaxy.com scmGalaxy Build file: example simple example build file

10 www.scmGalaxy.com scmGalaxy Build file: example <target name="compile" depends="init" description="compile the source " > <target name="dist" depends="compile" description="generate the distribution" >

11 www.scmGalaxy.com scmGalaxy Build file: example <target name="clean" description="clean up" >

12 www.scmGalaxy.com scmGalaxy Executing An Ant Script  In its basic form, an Ant script can be run by simply typing “Ant”  Command-line option summary: ant [options] [target [target2 [target3]...]]  Options (trimmed to fit page): -help print this message -version print the version information and exit -logfile file use given file for log output -logger classname the class that performs logging -buildfile file use specified buildfile

13 www.scmGalaxy.com scmGalaxy Some Ant Commands  calls a target in another build file useful to build subprojects  executes any CVS command  executes a system command

14 www.scmGalaxy.com scmGalaxy Some Ant Commands  generates javadoc HTML files from Java source files <javadoc packagenames="com.dummy.test.*" sourcepath="src" excludepackagenames="com.dummy.test.doc-files.*" destdir="docs/api" author="true" version="true" />  sends email using SMTP  creates a directory and any missing parent directories

15 www.scmGalaxy.com scmGalaxy Some Ant Commands  executes a sequence of SQL statements specified in the build file or an external text file, output can be written to a file insert into table some_table values(1,2,3,4);  expands a JAR file  expands a TAR file

16 www.scmGalaxy.com scmGalaxy References The ANT manual at ant.apache.org http://ant.apache.org/manual/

17 sG www.scmGalaxy.com Author: Rajesh Kumar rajeshkumar.raj06@gmail.com


Download ppt "SG Introduction to ANT scmGalaxy Author: Rajesh Kumar"

Similar presentations


Ads by Google