SlideShare a Scribd company logo
How to write a simple ANT build files for the Enterprise projects.
1/30/2015 Ravi Reddy (Ravinder Nancherla) 1
ANT Tutorials
 Tutorials How to write a build file for a simple Java project
Create a simple sample project in your eclipse IDE, Below is the screen shot and build script.
1/30/2015 Ravi Reddy (Ravinder Nancherla) 2
ANT Tutorials
 Build.xml
<project name="TestAnt" basedir="." default="run">
<!-- Clean Target -->
<target name="clean">
<delete dir="build"/>
</target>
<!-- Compile Target -->
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
</target>
<!-- Make JAR Target -->
<target name="jar">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/TestAnt.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="com.test.ant.EmployeeTestClient"/>
</manifest>
</jar>
</target>
<!-- Run JAR to execute the main class. -->
<target name="run">
<java jar="build/jar/TestAnt.jar" fork="true"/>
</target>
</project>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 3
ANT Tutorials
 Tutorials How to write a build file for a simple Java Web project
Create a simple sample web project in your eclipse IDE, Below is the screen shot and
build script.
1/30/2015 Ravi Reddy (Ravinder Nancherla) 4
ANT Tutorials
 Build.xml
<?xml version="1.0"?>
<project name="AntTestForWebApp" default="buildWar" basedir=".">
<property name="baseDir" value="${basedir}" />
<property name="src" value="${baseDir}/src" />
<property name="webRoot" value="${baseDir}/WebRoot" />
<property name="warDir" value="${baseDir}/build/war" />
<property name="libDir" value="${warDir}/WEB-INF/lib" />
<path id="libClasspath">
<fileset dir="${webRoot}/WEB-INF/lib" includes="**/*.jar" />
</path>
<!-- ========================= **** Clean Target **** =========================-->
<target name="clean">
<delete dir="${baseDir}/build" />
</target>
<!-- ========================= **** Init Target **** =========================-->
<target name="init">
<!-- Create Web-INF,lib, classes, META-INF directories -->
<mkdir dir="${libDir}" />
<mkdir dir="${warDir}/WEB-INF" />
<mkdir dir="${warDir}/WEB-INF/classes" />
<mkdir dir="${warDir}/META-INF" />
</target>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 5
ANT Tutorials
<!-- =================== **** COMPILE **** =======================================
Compile Java Files and place the following things in
1) *.classes files in WEB-INF/classes
2) *.jar files in WEB-INF/lib
3) web.xml in WEB-INF
4) *.jsp files in parent directory path build/war
================================================================================ -->
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${warDir}/WEB-INF/classes" debug="true" includes="**/*.java"
optimize="on">
<classpath refid="libClasspath" />
</javac>
<copy todir="${libDir}">
<fileset dir="${webRoot}/WEB-INF/lib" includes="**/*.jar" />
</copy>
<copy todir="${warDir}/WEB-INF">
<fileset dir="${webRoot}/WEB-INF" includes="web.xml" />
</copy>
<copy todir="${warDir}">
<fileset dir="${webRoot}" includes="*.jsp" />
</copy>
</target>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 6
ANT Tutorials
<!-- ========================= **** Create the WAR File **** =========================-->
<target name="buildWar">
<!-- Option 1: Using <jar> create war file and place WAR file in BUILD directory -->
<!--
<jar jarfile="${baseDir}/build/AntTestForWebApp.war" basedir="${warDir}" />
-->
<!-- Option 2: Using <war> create war file and place WAR file in BUILD directory -->
<war destfile="${baseDir}/build/AntTestForWebApp.war" webxml="${warDir}/WEB-INF/web.xml">
<zipfileset dir="${warDir}"/>
</war>
</target>
</project>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 7
ANT Tutorials
 Tutorials How to write a build file for a simple Java Web project
Create a simple sample EAR project in your eclipse IDE, Below is the screen
shot and build script.
1/30/2015 Ravi Reddy (Ravinder Nancherla) 8
ANT Tutorials
1/30/2015 Ravi Reddy (Ravinder Nancherla) 9
<?xml version = "1.0" encoding = "UTF-8"?>
<!-- ==========================================================================-->
<!-- Trying Build file for EAR Application -->
<!-- build.xml, Friday, August 27, 2010 -->
<!-- Author: Ravinder Nancherla -->
<!-- Email: ravinder.nancherla@gmail.com -->
<!-- Copyright(c) 2010 Ravinder Nancherla (Ravi Reddy)., All Rights Reserved. -->
<!-- ========================================================================= -->
<project name="AntEarWarJar" default="buildEar" basedir=".">
<property name="webModule" value="C:/SravanthiPractice/AntEarWarJarWeb"/>
<property name="ejbModule" value="C:/SravanthiPractice/AntEarWarJarEJB"/>
<property name="baseDir" value="${basedir}"/>
<property name="build" value="${baseDir}/build"/>
<property name="jarDir" value="${baseDir}/build/jar"/>
<property name="warDir" value="${baseDir}/build/war"/>
<property name="earDir" value="${baseDir}/build/ear"/>
<property name="webRootDir" value="${webModule}/WebRoot/WEB-INF"/>
<property name="webDir" value="${warDir}/WEB-INF"/>
<path id="libClasspath">
<fileset dir="${webRootDir}/lib" includes="**/*.jar" />
</path>
ANT Tutorials
<!-- Cleaning the build directory -->
<target name="clean">
<delete dir="${build}"/>
</target>
<!-- Initializing/Creating the directories -->
<target name="init" depends="clean">
<mkdir dir="${jarDir}/classes"/>
<mkdir dir="${jarDir}/jar"/>
<mkdir dir="${warDir}/META-INF"/>
<mkdir dir="${webDir}/classes"/>
<mkdir dir="${webDir}/lib"/>
<mkdir dir="${earDir}/META-INF"/>
</target>
<!-- Compiling and copying the files from EjbModule and WebModiule -->
<target name="compile" depends="init">
<javac srcdir="${ejbModule}/src" destdir="${jarDir}/classes" includes="**/*.java"/>
<javac srcdir="${webModule}/src" destdir="${webDir}/classes" includes="**/*.java">
<classpath refid="libClasspath"/>
</javac>
<copy todir="${webDir}/lib">
<fileset dir="${webRootDir}/lib" includes="**/*.jar"/>
</copy>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 10
ANT Tutorials
<copy todir="${webDir}">
<fileset dir="${webRootDir}" includes="web.xml"/>
</copy>
<copy todir="${warDir}">
<fileset dir="${webModule}/WebRoot" includes="**/*.jsp"/>
</copy>
<copy todir="${earDir}/META-INF">
<fileset dir="${baseDir}/META-INF" includes="**/*.*"/>
</copy>
</target>
<!-- Creating Jar File -->
<target name="buildJar" depends="compile">
<jar jarfile="${earDir}/${ant.project.name}.jar" basedir="${jarDir}"/>
<jar jarfile="${jarDir}/jar/${ant.project.name}.jar" basedir="${jarDir}"/>
</target>
<!-- Creating War File -->
<target name="buildWar" depends="compile">
<jar jarfile="${earDir}/${ant.project.name}.war" basedir="${warDir}"/>
</target>
<!-- Creating Ear File -->
<target name="buildEar" depends="buildJar,buildWar">
<jar jarfile="${build}/${ant.project.name}.ear" basedir="${earDir}"/>
</target>
</project>
1/30/2015 Ravi Reddy (Ravinder Nancherla) 11

More Related Content

What's hot

Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using Axe
RapidValue
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
Matthias Käppler
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
Vincent Massol
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
Igor Khotin
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
kyon mm
 
C fowler azure-dojo
C fowler azure-dojoC fowler azure-dojo
C fowler azure-dojo
sdeconf
 
What the heck went wrong?
What the heck went wrong?What the heck went wrong?
What the heck went wrong?
Andy McKay
 
Tackling Umbraco: Case Study on NFL Ops Website Design
Tackling Umbraco: Case Study on NFL Ops Website DesignTackling Umbraco: Case Study on NFL Ops Website Design
Tackling Umbraco: Case Study on NFL Ops Website Design
mcampolongo
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
Volodymyr Ostapiv
 
How to create a skeleton of a Java console application
How to create a skeleton of a Java console applicationHow to create a skeleton of a Java console application
How to create a skeleton of a Java console application
Dmitri Pisarenko
 
Vuex
VuexVuex
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合
Kyle Lin
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Oliver Ochs
 

What's hot (14)

Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using Axe
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projects
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-うさぎ組 in G* WorkShop -うさみみの日常-
うさぎ組 in G* WorkShop -うさみみの日常-
 
C fowler azure-dojo
C fowler azure-dojoC fowler azure-dojo
C fowler azure-dojo
 
What the heck went wrong?
What the heck went wrong?What the heck went wrong?
What the heck went wrong?
 
Tackling Umbraco: Case Study on NFL Ops Website Design
Tackling Umbraco: Case Study on NFL Ops Website DesignTackling Umbraco: Case Study on NFL Ops Website Design
Tackling Umbraco: Case Study on NFL Ops Website Design
 
Apache Maven basics
Apache Maven basicsApache Maven basics
Apache Maven basics
 
How to create a skeleton of a Java console application
How to create a skeleton of a Java console applicationHow to create a skeleton of a Java console application
How to create a skeleton of a Java console application
 
Vuex
VuexVuex
Vuex
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合
 
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit MavenBuilding Performance - ein Frontend-Build-Prozess für Java mit Maven
Building Performance - ein Frontend-Build-Prozess für Java mit Maven
 

Similar to Tutorial to develop build files using ANT

Ant
AntAnt
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
Shih-Hsiang Lin
 
Build Scripts
Build ScriptsBuild Scripts
Ant_quick_guide
Ant_quick_guideAnt_quick_guide
Ant_quick_guide
ducquoc_vn
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
De Mello Adriany
 
Apache ant
Apache antApache ant
Apache ant
koniik
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overview
Balduran Chang
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
vodQA
 
DCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best PracticesDCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best Practices
Docker, Inc.
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
Igor Khotin
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
Manav Prasad
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
Renat Bekbolatov
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
JWORKS powered by Ordina
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
Steve De Zitter
 
Apache ant
Apache antApache ant
Apache ant
Yuriy Galavay
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
Arcadian Learning
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
JavaZone 2015: Mine containere er lettere enn dine.
JavaZone 2015: Mine containere er lettere enn dine.JavaZone 2015: Mine containere er lettere enn dine.
JavaZone 2015: Mine containere er lettere enn dine.
Anders Breivik
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
Mika Koivisto
 
Ant build tool2
Ant   build tool2Ant   build tool2
Ant build tool2
Rohit Kumar
 

Similar to Tutorial to develop build files using ANT (20)

Ant
AntAnt
Ant
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Build Scripts
Build ScriptsBuild Scripts
Build Scripts
 
Ant_quick_guide
Ant_quick_guideAnt_quick_guide
Ant_quick_guide
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
 
Apache ant
Apache antApache ant
Apache ant
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overview
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 
DCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best PracticesDCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best Practices
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
 
SBT Concepts, part 2
SBT Concepts, part 2SBT Concepts, part 2
SBT Concepts, part 2
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC Mobile
 
Apache ant
Apache antApache ant
Apache ant
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with Maven
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
JavaZone 2015: Mine containere er lettere enn dine.
JavaZone 2015: Mine containere er lettere enn dine.JavaZone 2015: Mine containere er lettere enn dine.
JavaZone 2015: Mine containere er lettere enn dine.
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
Ant build tool2
Ant   build tool2Ant   build tool2
Ant build tool2
 

More from ravireddy76

Groovy in SOAP UI
Groovy in SOAP UIGroovy in SOAP UI
Groovy in SOAP UI
ravireddy76
 
WID (Websphere Integration Development) Guide
WID (Websphere Integration Development) GuideWID (Websphere Integration Development) Guide
WID (Websphere Integration Development) Guide
ravireddy76
 
Maven
MavenMaven
Flex Proto Type
Flex  Proto  TypeFlex  Proto  Type
Flex Proto Type
ravireddy76
 
Richfaces Proto Type
Richfaces Proto TypeRichfaces Proto Type
Richfaces Proto Type
ravireddy76
 
Icefaces Proto Type
Icefaces Proto TypeIcefaces Proto Type
Icefaces Proto Type
ravireddy76
 

More from ravireddy76 (6)

Groovy in SOAP UI
Groovy in SOAP UIGroovy in SOAP UI
Groovy in SOAP UI
 
WID (Websphere Integration Development) Guide
WID (Websphere Integration Development) GuideWID (Websphere Integration Development) Guide
WID (Websphere Integration Development) Guide
 
Maven
MavenMaven
Maven
 
Flex Proto Type
Flex  Proto  TypeFlex  Proto  Type
Flex Proto Type
 
Richfaces Proto Type
Richfaces Proto TypeRichfaces Proto Type
Richfaces Proto Type
 
Icefaces Proto Type
Icefaces Proto TypeIcefaces Proto Type
Icefaces Proto Type
 

Recently uploaded

FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
Data Hops
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
maazsz111
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 

Recently uploaded (20)

FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3FREE A4 Cyber Security Awareness  Posters-Social Engineering part 3
FREE A4 Cyber Security Awareness Posters-Social Engineering part 3
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 

Tutorial to develop build files using ANT

  • 1. How to write a simple ANT build files for the Enterprise projects. 1/30/2015 Ravi Reddy (Ravinder Nancherla) 1
  • 2. ANT Tutorials  Tutorials How to write a build file for a simple Java project Create a simple sample project in your eclipse IDE, Below is the screen shot and build script. 1/30/2015 Ravi Reddy (Ravinder Nancherla) 2
  • 3. ANT Tutorials  Build.xml <project name="TestAnt" basedir="." default="run"> <!-- Clean Target --> <target name="clean"> <delete dir="build"/> </target> <!-- Compile Target --> <target name="compile"> <mkdir dir="build/classes"/> <javac srcdir="src" destdir="build/classes"/> </target> <!-- Make JAR Target --> <target name="jar"> <mkdir dir="build/jar"/> <jar destfile="build/jar/TestAnt.jar" basedir="build/classes"> <manifest> <attribute name="Main-Class" value="com.test.ant.EmployeeTestClient"/> </manifest> </jar> </target> <!-- Run JAR to execute the main class. --> <target name="run"> <java jar="build/jar/TestAnt.jar" fork="true"/> </target> </project> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 3
  • 4. ANT Tutorials  Tutorials How to write a build file for a simple Java Web project Create a simple sample web project in your eclipse IDE, Below is the screen shot and build script. 1/30/2015 Ravi Reddy (Ravinder Nancherla) 4
  • 5. ANT Tutorials  Build.xml <?xml version="1.0"?> <project name="AntTestForWebApp" default="buildWar" basedir="."> <property name="baseDir" value="${basedir}" /> <property name="src" value="${baseDir}/src" /> <property name="webRoot" value="${baseDir}/WebRoot" /> <property name="warDir" value="${baseDir}/build/war" /> <property name="libDir" value="${warDir}/WEB-INF/lib" /> <path id="libClasspath"> <fileset dir="${webRoot}/WEB-INF/lib" includes="**/*.jar" /> </path> <!-- ========================= **** Clean Target **** =========================--> <target name="clean"> <delete dir="${baseDir}/build" /> </target> <!-- ========================= **** Init Target **** =========================--> <target name="init"> <!-- Create Web-INF,lib, classes, META-INF directories --> <mkdir dir="${libDir}" /> <mkdir dir="${warDir}/WEB-INF" /> <mkdir dir="${warDir}/WEB-INF/classes" /> <mkdir dir="${warDir}/META-INF" /> </target> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 5
  • 6. ANT Tutorials <!-- =================== **** COMPILE **** ======================================= Compile Java Files and place the following things in 1) *.classes files in WEB-INF/classes 2) *.jar files in WEB-INF/lib 3) web.xml in WEB-INF 4) *.jsp files in parent directory path build/war ================================================================================ --> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${warDir}/WEB-INF/classes" debug="true" includes="**/*.java" optimize="on"> <classpath refid="libClasspath" /> </javac> <copy todir="${libDir}"> <fileset dir="${webRoot}/WEB-INF/lib" includes="**/*.jar" /> </copy> <copy todir="${warDir}/WEB-INF"> <fileset dir="${webRoot}/WEB-INF" includes="web.xml" /> </copy> <copy todir="${warDir}"> <fileset dir="${webRoot}" includes="*.jsp" /> </copy> </target> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 6
  • 7. ANT Tutorials <!-- ========================= **** Create the WAR File **** =========================--> <target name="buildWar"> <!-- Option 1: Using <jar> create war file and place WAR file in BUILD directory --> <!-- <jar jarfile="${baseDir}/build/AntTestForWebApp.war" basedir="${warDir}" /> --> <!-- Option 2: Using <war> create war file and place WAR file in BUILD directory --> <war destfile="${baseDir}/build/AntTestForWebApp.war" webxml="${warDir}/WEB-INF/web.xml"> <zipfileset dir="${warDir}"/> </war> </target> </project> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 7
  • 8. ANT Tutorials  Tutorials How to write a build file for a simple Java Web project Create a simple sample EAR project in your eclipse IDE, Below is the screen shot and build script. 1/30/2015 Ravi Reddy (Ravinder Nancherla) 8
  • 9. ANT Tutorials 1/30/2015 Ravi Reddy (Ravinder Nancherla) 9 <?xml version = "1.0" encoding = "UTF-8"?> <!-- ==========================================================================--> <!-- Trying Build file for EAR Application --> <!-- build.xml, Friday, August 27, 2010 --> <!-- Author: Ravinder Nancherla --> <!-- Email: ravinder.nancherla@gmail.com --> <!-- Copyright(c) 2010 Ravinder Nancherla (Ravi Reddy)., All Rights Reserved. --> <!-- ========================================================================= --> <project name="AntEarWarJar" default="buildEar" basedir="."> <property name="webModule" value="C:/SravanthiPractice/AntEarWarJarWeb"/> <property name="ejbModule" value="C:/SravanthiPractice/AntEarWarJarEJB"/> <property name="baseDir" value="${basedir}"/> <property name="build" value="${baseDir}/build"/> <property name="jarDir" value="${baseDir}/build/jar"/> <property name="warDir" value="${baseDir}/build/war"/> <property name="earDir" value="${baseDir}/build/ear"/> <property name="webRootDir" value="${webModule}/WebRoot/WEB-INF"/> <property name="webDir" value="${warDir}/WEB-INF"/> <path id="libClasspath"> <fileset dir="${webRootDir}/lib" includes="**/*.jar" /> </path>
  • 10. ANT Tutorials <!-- Cleaning the build directory --> <target name="clean"> <delete dir="${build}"/> </target> <!-- Initializing/Creating the directories --> <target name="init" depends="clean"> <mkdir dir="${jarDir}/classes"/> <mkdir dir="${jarDir}/jar"/> <mkdir dir="${warDir}/META-INF"/> <mkdir dir="${webDir}/classes"/> <mkdir dir="${webDir}/lib"/> <mkdir dir="${earDir}/META-INF"/> </target> <!-- Compiling and copying the files from EjbModule and WebModiule --> <target name="compile" depends="init"> <javac srcdir="${ejbModule}/src" destdir="${jarDir}/classes" includes="**/*.java"/> <javac srcdir="${webModule}/src" destdir="${webDir}/classes" includes="**/*.java"> <classpath refid="libClasspath"/> </javac> <copy todir="${webDir}/lib"> <fileset dir="${webRootDir}/lib" includes="**/*.jar"/> </copy> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 10
  • 11. ANT Tutorials <copy todir="${webDir}"> <fileset dir="${webRootDir}" includes="web.xml"/> </copy> <copy todir="${warDir}"> <fileset dir="${webModule}/WebRoot" includes="**/*.jsp"/> </copy> <copy todir="${earDir}/META-INF"> <fileset dir="${baseDir}/META-INF" includes="**/*.*"/> </copy> </target> <!-- Creating Jar File --> <target name="buildJar" depends="compile"> <jar jarfile="${earDir}/${ant.project.name}.jar" basedir="${jarDir}"/> <jar jarfile="${jarDir}/jar/${ant.project.name}.jar" basedir="${jarDir}"/> </target> <!-- Creating War File --> <target name="buildWar" depends="compile"> <jar jarfile="${earDir}/${ant.project.name}.war" basedir="${warDir}"/> </target> <!-- Creating Ear File --> <target name="buildEar" depends="buildJar,buildWar"> <jar jarfile="${build}/${ant.project.name}.ear" basedir="${earDir}"/> </target> </project> 1/30/2015 Ravi Reddy (Ravinder Nancherla) 11