SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 1/6
Codin | Home | Previous | Index | Next
ANT - Build Tool
# Introduction:
If we are developing only web application or enterprise application, we need to
follow below steps to run the application in the server:
1. Develope required files(.java, .jsp, .html etc)
2. Set the required .jar files into classpath.
3. Generate .class files.
4. Create required directory structure.
5. Generate .war file.
6. Start the server.
7. Deploy .war file into server.
8. To verify functionality of our application based on our project to
requirement.
9. Sometimes we need to stop server.
10. Sometimes we need to undeploy the application.
All the above steps are called as Build Process steps for Java application.
If we are manually follow all the above build process steps then it will increases the
project developement time and it is also increases the project cost.
To resolve these problems we need to use any one of build tool.
If we are using any of the build tool in our application to automate build process
steps then it will decreases project developement time and project developement
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 2/6
cost.
Now we have two build tools in the market to automate build process steps for the
Java applications.
1. ANT, 2. MAVEN
1. ANT: ANT is a build tool, by using this tool we can automate build process
steps for Java applications.
-It is an open source framework which is given by Apache Software
Foundation.
-ANT build tool developed by using Java language.
Environment setup for the ANT:
1. Download ANT software (ant...zip file) from Apache website.
http://ant.apache.org
2. Extract the zip, and set two system environment variables:
ANT_HOME=E:apache-ant-1.8.4
PATH=......;E:apache-ant-1.8.4bin
3. To verify whether ANT successfully installed or not, we need to apen
command prompt and enter below command:
c:ant -version
If we want automate build process steps by using ANT build tool then we need to
provide some instructions about our build process steps in the form of XML tags to the
ANT build tool and that XML file name should be "build.xml" file and we need to save
the "build.xml" file in the project root directory.
To run build.xml file we need to open command prompt and go to where our
build.xml file existed.
Now to run build.xml file we have 2 ways:
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 3/6
1. Executing target by target - To execute target by target we execute below
command:
Syntax: E:helloworldant <target name>
Example: E:helloworldant compile
2. Executing default target - If we want to execute default target we need to
use "default" attribute in <target> tag and we need to use "depends" attribute in
all the target tags.
Requirement2
# ANT build.xml with Properties file:
Sometimes we need to frequently change directory paths and file names in the
build.xml file, so that we need to change directory paths and file names if build.xml
file wherever we are using.
If we forget to change directory path and file name in any one of the place in
build.xml file then build will be failed.
To resolve these problems we need to define properties for the frequently used
files names and directory paths using <property> tag. Syntax:
build.xml
<project....>
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 4/6
<propertyname="classes.dir"value="build/classes"/>
.....
</project>
If we want to use property names in the build.xml file then we need to expression
language (${<property-name>})
ANT build.xml file using Property file:
-Instead of defining properties in build.xml file directly we need to define all
the properties in separate file called "build.properties".
-We can define any name for the properties file, but we should define
meaningful name, and we need to store this "build.properties" file inside
where our build.xml file is exists.
-If we are using properties file to define the ANT build prperties then we need
to specify properties file name and path in build.xml file using <property> tag.
Syntax:
<project...>
...
<propertyfile="build.properties"/>
...
</project>
build.properties
classes.dir=build/classes
# Working with IDE:
All the latest IDE tools having ANT plugins so that we can directly run build.xml file
from the IDE tool.
Create any standalone project or web project in Eclipse and create build.xml file in
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 5/6
project.
We have 3 ways to run the build.xml file in Eclipse:
1. Executing default target
2. Executing target by target
3. Executing build.xml file using "ANT view panel".
1. Executing default target: Right click on build.xml file->Run As->click on "ANT
Build".
2. Executing target by target: Right click on build.xml file->Run As->click on "ANT
Build..." check target name and click on Run button.
3. Executing using "ANT view panel": To run build.xml file using ANT view panel first
we need to open ANT view panel so to open ANT view panel we need:
Go to left Bottom corner of Eclipse->click on "show view as fast view"->click
on others->Expand ANT->Select "ANT"->click on OK.
-We need to add our project build.xml file to the ANT view panel.
Right click on "ANT view panel"->Add Build files->Browse our project->click on
build.xml->OK
Expand build.xml file and double click on required target to run.
Codin | Home | Previous | Index | Next
6/6/13 ANT - Build Tool
file:///D:/codin/ant/index.html 6/6
© Rohit Rakshit

Mais conteúdo relacionado

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Destaque

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Ant build tool1

  • 1. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 1/6 Codin | Home | Previous | Index | Next ANT - Build Tool # Introduction: If we are developing only web application or enterprise application, we need to follow below steps to run the application in the server: 1. Develope required files(.java, .jsp, .html etc) 2. Set the required .jar files into classpath. 3. Generate .class files. 4. Create required directory structure. 5. Generate .war file. 6. Start the server. 7. Deploy .war file into server. 8. To verify functionality of our application based on our project to requirement. 9. Sometimes we need to stop server. 10. Sometimes we need to undeploy the application. All the above steps are called as Build Process steps for Java application. If we are manually follow all the above build process steps then it will increases the project developement time and it is also increases the project cost. To resolve these problems we need to use any one of build tool. If we are using any of the build tool in our application to automate build process steps then it will decreases project developement time and project developement
  • 2. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 2/6 cost. Now we have two build tools in the market to automate build process steps for the Java applications. 1. ANT, 2. MAVEN 1. ANT: ANT is a build tool, by using this tool we can automate build process steps for Java applications. -It is an open source framework which is given by Apache Software Foundation. -ANT build tool developed by using Java language. Environment setup for the ANT: 1. Download ANT software (ant...zip file) from Apache website. http://ant.apache.org 2. Extract the zip, and set two system environment variables: ANT_HOME=E:apache-ant-1.8.4 PATH=......;E:apache-ant-1.8.4bin 3. To verify whether ANT successfully installed or not, we need to apen command prompt and enter below command: c:ant -version If we want automate build process steps by using ANT build tool then we need to provide some instructions about our build process steps in the form of XML tags to the ANT build tool and that XML file name should be "build.xml" file and we need to save the "build.xml" file in the project root directory. To run build.xml file we need to open command prompt and go to where our build.xml file existed. Now to run build.xml file we have 2 ways:
  • 3. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 3/6 1. Executing target by target - To execute target by target we execute below command: Syntax: E:helloworldant <target name> Example: E:helloworldant compile 2. Executing default target - If we want to execute default target we need to use "default" attribute in <target> tag and we need to use "depends" attribute in all the target tags. Requirement2 # ANT build.xml with Properties file: Sometimes we need to frequently change directory paths and file names in the build.xml file, so that we need to change directory paths and file names if build.xml file wherever we are using. If we forget to change directory path and file name in any one of the place in build.xml file then build will be failed. To resolve these problems we need to define properties for the frequently used files names and directory paths using <property> tag. Syntax: build.xml <project....>
  • 4. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 4/6 <propertyname="classes.dir"value="build/classes"/> ..... </project> If we want to use property names in the build.xml file then we need to expression language (${<property-name>}) ANT build.xml file using Property file: -Instead of defining properties in build.xml file directly we need to define all the properties in separate file called "build.properties". -We can define any name for the properties file, but we should define meaningful name, and we need to store this "build.properties" file inside where our build.xml file is exists. -If we are using properties file to define the ANT build prperties then we need to specify properties file name and path in build.xml file using <property> tag. Syntax: <project...> ... <propertyfile="build.properties"/> ... </project> build.properties classes.dir=build/classes # Working with IDE: All the latest IDE tools having ANT plugins so that we can directly run build.xml file from the IDE tool. Create any standalone project or web project in Eclipse and create build.xml file in
  • 5. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 5/6 project. We have 3 ways to run the build.xml file in Eclipse: 1. Executing default target 2. Executing target by target 3. Executing build.xml file using "ANT view panel". 1. Executing default target: Right click on build.xml file->Run As->click on "ANT Build". 2. Executing target by target: Right click on build.xml file->Run As->click on "ANT Build..." check target name and click on Run button. 3. Executing using "ANT view panel": To run build.xml file using ANT view panel first we need to open ANT view panel so to open ANT view panel we need: Go to left Bottom corner of Eclipse->click on "show view as fast view"->click on others->Expand ANT->Select "ANT"->click on OK. -We need to add our project build.xml file to the ANT view panel. Right click on "ANT view panel"->Add Build files->Browse our project->click on build.xml->OK Expand build.xml file and double click on required target to run. Codin | Home | Previous | Index | Next
  • 6. 6/6/13 ANT - Build Tool file:///D:/codin/ant/index.html 6/6 © Rohit Rakshit