Puneet SHARMA
 Introduction – What & Why
 Installing and Executing ANT
 ANT Terminologies and Concepts
 Core ANT tasks
 Creating a build file
 Execute an executable
 Executing SQL queries
 DEMO
 Queries
 Apache Ant (Ant) is a general purpose build tool. Ant
is an abbreviation for Another Neat Tool.
 Ant is primarily used for building and deploying Java
projects but can be used for every possible repetitive
tasks.
 ANT is Operating System and Language Neutral.
 ANT is implemented in Java.
 Ant can get source code from version control
 CVS, Subversion, Synergy, Perforce, ClearCase and many
more
 Ant can compile source code
 Ant can run unit tests
 JUnit3, JUnit4, TestNG, or any arbitrary test application
 Ant can package compiled code and resources
 jars, wars, ears, tars, zips, whatever
 Download latest stable zip file
from http://ant.apache.org/bindownload.cgi
 Unzip downloaded file into a directory
 Setup Environment Variables
 Define ANT_HOME to be the location where Ant was
unzipped
 Define JAVA_HOME to be the location where the JDK is
installed
 Add %ANT_HOME%bin to the PATH
 Check your installation by opening a command line
and typing ant -version into the commend line.
 Ant Project – a collection of named targets that can
run in any order. Each build file contains one project.
 Ant Target – a fixed series of ant tasks in a specified
order that can depend on other named targets. Targets
can depend only on other targets, not on projects or
tasks. A target represents a particular item to be
created, it can be a single item like a jar, or a group of
items, like classes.
 Ant Task – something that ant can execute such as a
compile, copy or replace. Most tasks have very
convenient default values.
 Each build file should contains one project which contains
the targets and the tasks to perform.
 A project has three attributes:
 Each project defines one or more targets. A target is a set
of tasks you want to be executed. When starting Ant, you
can select which target(s) you want to have executed.
When no target is given, the project's default is used.
Attribute Description Required
name The name of the project. No
default The default target to use when no target is supplied. No
basedir The base directory from which all path calculations are done. No
 A target is a container of tasks that cooperate to reach
a desired state during the build process.
 Targets can depend on other targets and Apache Ant
ensures that these other targets have been executed
before the current target.
 A target has the following attributes:
Attribute Description Required
name The name of the target. Yes
depends A comma-separated list of names of targets on
which this target depends.
No
if The name of the property that must be set in
order for this target to execute.
No
unless The name of the property that must not be set in
order for this target to execute.
No
description A short description of this target's function. No
 A task is a piece of code that can be executed.
 We have inbuilt tasks available for all the basic functions
needed for the build creation and automation.
 File Tasks:
<copy>, <concat>, <delete>, <filter>, <fixcrlf>, <get>
 Compile Tasks:
<javac>, <apt>,<rmic>
 Archive Tasks:
<zip>, <unzip>,<war>,<unwar>,<ear>
 Testing Tasks:
<junit>,<junitreport>
 Miscelleneous Tasks:
<echo>,<javadoc>,<sql>
Ant AntCall ANTLR AntStructure AntVersion Apply/ExecOn Apt Attrib Augment Avail
Basename Bindtargets BuildNumber BUnzip2 BZip2 Cab Continuus/Synergy Tasks CvsChangeLog Checksum Chg
Chmod Chown Clearcase Tasks Componentdef Concat Condition Supported conditions Copy Copydir Cop
Cvs CVSPass CvsTagDiff CvsVersion Defaultexcludes Delete Deltree Depend Dependset Diagn
Dirname Ear Echo Echoproperties EchoXML EJB Tasks Exec Fail Filter FixC
FTP GenKey Get GUnzip GZip Hostinfo Image Import Include Inp
Jar Jarlib-available Jarlib-display Jarlib-manifest Jarlib-resolve Java Javac JavaCC Javadoc/Javadoc2 Jav
JDepend JJDoc JJTree Jlink JspC JUnit JUnitReport Length LoadFile LoadPro
LoadResource Local MacroDef Mail MakeURL Manifest ManifestClassPath MimeMail Mkdir Mo
Native2Ascii NetRexxC Nice Parallel Patch PathConvert
PropertyFile
PreSetDef ProjectHelper Prop
PropertyHelper Pvcs Record Rename RenameExtensions Replace ReplaceRegExp ResourceCount Retry REx
Rmic Rpm SchemaValidate Scp Script Scriptdef Sequential ServerDeploy Setproxy Sign
Sleep SourceOffSite Sound Splash Sql Sshexec Sshsession Subant Symlink Sy
Tar Taskdef Telnet Tempfile Touch Translate Truncate TStamp Typedef Un
Unwar
Untar
Unzip Uptodate VerifyJar
Microsoft
Visual
SourceSafe
Tasks Waitfor War WhichResource
Weblo
Com
XmlProperty
XmlValidate XSLT/Style Zip
 Build File is an XML file which contains all the
configuration which is executed by ANT to create
build and performing other Tasks.
 The Sample Build file to create a build is attached
below:
 EXEC is an inbuilt task in Ant which helps us to run
any executable through ANT.
 Sample Execution of MQL
<target name="exec-mql">
<exec executable="mql -c">
<arg value="set context user creator;compile prog
* force update;"/>
</exec>
</target>
 Sometimes executing SQL queries also is a part of
application build. In that case ANT can help you to
automate the SQL execution as a part of ANT build.
 Connecting to Database:
<sql
driver="org.database.jdbcDriver”
url="jdbc:database-url”
userid="sa”
password="pass”
src="data.sql”
/>
 Here src conatins the sql script to be executed.
 Executing Query:
<sql
driver="org.database.jdbcDriver”
url="jdbc:database-url”
userid="sa”
password="pass”>
truncate table some_other_table;
</sql>
 Executing Query:
<sql
driver="org.database.jdbcDriver”
url="jdbc:database-url”
userid="sa”
password="pass” >
<transaction src="data1.sql"/>
<transaction src="data2.sql"/>
<transaction src="data3.sql"/>
<transaction>
truncate table some_other_table;
</transaction>
</sql>
Basics of ANT
Basics of ANT
ANT
Puneet Sharma.

More Related Content

PDF
Ida python intro
PDF
Introduction to ida python
ODP
Intro To Spring Python
PPT
Using Ant To Build J2 Ee Applications
PPTX
Apache Ant
PPT
Apache Ant
PDF
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
PPT
Introduction to Apache Ant
Ida python intro
Introduction to ida python
Intro To Spring Python
Using Ant To Build J2 Ee Applications
Apache Ant
Apache Ant
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
Introduction to Apache Ant

What's hot (20)

PPTX
Interpreter RPG to Java
PDF
How to Reverse Engineer Web Applications
PPTX
EclipseMAT
PPT
Apache Ant
PPTX
Apache ant
PDF
Effective testing with pytest
PPT
Ant - Another Neat Tool
PDF
Modern Python Testing
PDF
Ant tutorial
PPT
Apache Ant
PPT
Beyond Unit Testing
PPTX
Automation patterns on practice
PDF
Python testing using mock and pytest
PPTX
Apache ant
ODT
Testing in-python-and-pytest-framework
PDF
Maven 3.0 at Øredev
PDF
Unit Testing from Setup to Deployment
PDF
Puppet Systems Infrastructure Construction Kit
PDF
Testing Django Applications
PPT
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Interpreter RPG to Java
How to Reverse Engineer Web Applications
EclipseMAT
Apache Ant
Apache ant
Effective testing with pytest
Ant - Another Neat Tool
Modern Python Testing
Ant tutorial
Apache Ant
Beyond Unit Testing
Automation patterns on practice
Python testing using mock and pytest
Apache ant
Testing in-python-and-pytest-framework
Maven 3.0 at Øredev
Unit Testing from Setup to Deployment
Puppet Systems Infrastructure Construction Kit
Testing Django Applications
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Ad

Similar to Basics of ANT (20)

PPT
Introduction To Ant1
PPT
Intro to-ant
PPT
PPT
Ant - Another Neat Tool
PDF
Deploy Flex with Apache Ant
PDF
Java ant tutorial
PDF
Ant_quick_guide
PDF
PPT
PDF
Introduction to Apache Ant
PDF
Ant tutorial
PPT
PDF
Utilized Ant to do Windchill Deployment
PPTX
CodeIgniter Ant Scripting
PPTX
Apache Ant
PPTX
PPT
Introduction To Ant
ODP
Ant User Guide
PPTX
Java build tools
PPTX
Maven and ANT
Introduction To Ant1
Intro to-ant
Ant - Another Neat Tool
Deploy Flex with Apache Ant
Java ant tutorial
Ant_quick_guide
Introduction to Apache Ant
Ant tutorial
Utilized Ant to do Windchill Deployment
CodeIgniter Ant Scripting
Apache Ant
Introduction To Ant
Ant User Guide
Java build tools
Maven and ANT
Ad

Recently uploaded (20)

PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
Wondershare Recoverit Full Crack New Version (Latest 2025)
PPTX
Trending Python Topics for Data Visualization in 2025
PPTX
"Secure File Sharing Solutions on AWS".pptx
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
MCP Security Tutorial - Beginner to Advanced
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Salesforce Agentforce AI Implementation.pdf
Weekly report ppt - harsh dattuprasad patel.pptx
iTop VPN Crack Latest Version Full Key 2025
Wondershare Recoverit Full Crack New Version (Latest 2025)
Trending Python Topics for Data Visualization in 2025
"Secure File Sharing Solutions on AWS".pptx
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
Monitoring Stack: Grafana, Loki & Promtail
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
MCP Security Tutorial - Beginner to Advanced
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
How Tridens DevSecOps Ensures Compliance, Security, and Agility
DNT Brochure 2025 – ISV Solutions @ D365
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
Oracle Fusion HCM Cloud Demo for Beginners
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)

Basics of ANT

  • 2.  Introduction – What & Why  Installing and Executing ANT  ANT Terminologies and Concepts  Core ANT tasks  Creating a build file  Execute an executable  Executing SQL queries  DEMO  Queries
  • 3.  Apache Ant (Ant) is a general purpose build tool. Ant is an abbreviation for Another Neat Tool.  Ant is primarily used for building and deploying Java projects but can be used for every possible repetitive tasks.  ANT is Operating System and Language Neutral.  ANT is implemented in Java.
  • 4.  Ant can get source code from version control  CVS, Subversion, Synergy, Perforce, ClearCase and many more  Ant can compile source code  Ant can run unit tests  JUnit3, JUnit4, TestNG, or any arbitrary test application  Ant can package compiled code and resources  jars, wars, ears, tars, zips, whatever
  • 5.  Download latest stable zip file from http://ant.apache.org/bindownload.cgi  Unzip downloaded file into a directory  Setup Environment Variables  Define ANT_HOME to be the location where Ant was unzipped  Define JAVA_HOME to be the location where the JDK is installed  Add %ANT_HOME%bin to the PATH  Check your installation by opening a command line and typing ant -version into the commend line.
  • 6.  Ant Project – a collection of named targets that can run in any order. Each build file contains one project.  Ant Target – a fixed series of ant tasks in a specified order that can depend on other named targets. Targets can depend only on other targets, not on projects or tasks. A target represents a particular item to be created, it can be a single item like a jar, or a group of items, like classes.  Ant Task – something that ant can execute such as a compile, copy or replace. Most tasks have very convenient default values.
  • 7.  Each build file should contains one project which contains the targets and the tasks to perform.  A project has three attributes:  Each project defines one or more targets. A target is a set of tasks you want to be executed. When starting Ant, you can select which target(s) you want to have executed. When no target is given, the project's default is used. Attribute Description Required name The name of the project. No default The default target to use when no target is supplied. No basedir The base directory from which all path calculations are done. No
  • 8.  A target is a container of tasks that cooperate to reach a desired state during the build process.  Targets can depend on other targets and Apache Ant ensures that these other targets have been executed before the current target.  A target has the following attributes: Attribute Description Required name The name of the target. Yes depends A comma-separated list of names of targets on which this target depends. No if The name of the property that must be set in order for this target to execute. No unless The name of the property that must not be set in order for this target to execute. No description A short description of this target's function. No
  • 9.  A task is a piece of code that can be executed.  We have inbuilt tasks available for all the basic functions needed for the build creation and automation.  File Tasks: <copy>, <concat>, <delete>, <filter>, <fixcrlf>, <get>  Compile Tasks: <javac>, <apt>,<rmic>  Archive Tasks: <zip>, <unzip>,<war>,<unwar>,<ear>  Testing Tasks: <junit>,<junitreport>  Miscelleneous Tasks: <echo>,<javadoc>,<sql>
  • 10. Ant AntCall ANTLR AntStructure AntVersion Apply/ExecOn Apt Attrib Augment Avail Basename Bindtargets BuildNumber BUnzip2 BZip2 Cab Continuus/Synergy Tasks CvsChangeLog Checksum Chg Chmod Chown Clearcase Tasks Componentdef Concat Condition Supported conditions Copy Copydir Cop Cvs CVSPass CvsTagDiff CvsVersion Defaultexcludes Delete Deltree Depend Dependset Diagn Dirname Ear Echo Echoproperties EchoXML EJB Tasks Exec Fail Filter FixC FTP GenKey Get GUnzip GZip Hostinfo Image Import Include Inp Jar Jarlib-available Jarlib-display Jarlib-manifest Jarlib-resolve Java Javac JavaCC Javadoc/Javadoc2 Jav JDepend JJDoc JJTree Jlink JspC JUnit JUnitReport Length LoadFile LoadPro LoadResource Local MacroDef Mail MakeURL Manifest ManifestClassPath MimeMail Mkdir Mo Native2Ascii NetRexxC Nice Parallel Patch PathConvert PropertyFile PreSetDef ProjectHelper Prop PropertyHelper Pvcs Record Rename RenameExtensions Replace ReplaceRegExp ResourceCount Retry REx Rmic Rpm SchemaValidate Scp Script Scriptdef Sequential ServerDeploy Setproxy Sign Sleep SourceOffSite Sound Splash Sql Sshexec Sshsession Subant Symlink Sy Tar Taskdef Telnet Tempfile Touch Translate Truncate TStamp Typedef Un Unwar Untar Unzip Uptodate VerifyJar Microsoft Visual SourceSafe Tasks Waitfor War WhichResource Weblo Com XmlProperty XmlValidate XSLT/Style Zip
  • 11.  Build File is an XML file which contains all the configuration which is executed by ANT to create build and performing other Tasks.  The Sample Build file to create a build is attached below:
  • 12.  EXEC is an inbuilt task in Ant which helps us to run any executable through ANT.  Sample Execution of MQL <target name="exec-mql"> <exec executable="mql -c"> <arg value="set context user creator;compile prog * force update;"/> </exec> </target>
  • 13.  Sometimes executing SQL queries also is a part of application build. In that case ANT can help you to automate the SQL execution as a part of ANT build.  Connecting to Database: <sql driver="org.database.jdbcDriver” url="jdbc:database-url” userid="sa” password="pass” src="data.sql” />  Here src conatins the sql script to be executed.
  • 15.  Executing Query: <sql driver="org.database.jdbcDriver” url="jdbc:database-url” userid="sa” password="pass” > <transaction src="data1.sql"/> <transaction src="data2.sql"/> <transaction src="data3.sql"/> <transaction> truncate table some_other_table; </transaction> </sql>