SlideShare uma empresa Scribd logo
1 de 11
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

Mais conteúdo relacionado

Mais procurados

Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using AxeRapidValue
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
Implementing Quality on Java projects
Implementing Quality on Java projectsImplementing Quality on Java projects
Implementing Quality on Java projectsVincent Massol
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another buildIgor 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-dojosdeconf
 
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 Designmcampolongo
 
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 applicationDmitri Pisarenko
 
淺談 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 MavenOliver Ochs
 

Mais procurados (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
 

Semelhante a Tutorial to develop build files using ANT

Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache AntShih-Hsiang Lin
 
Ant_quick_guide
Ant_quick_guideAnt_quick_guide
Ant_quick_guideducquoc_vn
 
Apache ant
Apache antApache ant
Apache antkoniik
 
OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overviewBalduran Chang
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 
DCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best PracticesDCSF19 Dockerfile Best Practices
DCSF19 Dockerfile Best PracticesDocker, Inc.
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC MobileSteve De Zitter
 
Android secure offline storage - CC Mobile
Android secure offline storage - CC MobileAndroid secure offline storage - CC Mobile
Android secure offline storage - CC MobileJWORKS powered by Ordina
 
Training in Android with Maven
Training in Android with MavenTraining in Android with Maven
Training in Android with MavenArcadian Learning
 
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
 

Semelhante a 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
 

Mais de ravireddy76

Groovy in SOAP UI
Groovy in SOAP UIGroovy in SOAP UI
Groovy in SOAP UIravireddy76
 
WID (Websphere Integration Development) Guide
WID (Websphere Integration Development) GuideWID (Websphere Integration Development) Guide
WID (Websphere Integration Development) Guideravireddy76
 
Richfaces Proto Type
Richfaces Proto TypeRichfaces Proto Type
Richfaces Proto Typeravireddy76
 
Icefaces Proto Type
Icefaces Proto TypeIcefaces Proto Type
Icefaces Proto Typeravireddy76
 

Mais de 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
 

Último

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
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
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 

Último (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.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)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

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