SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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 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
 

Similar 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
 

Más 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
 

Más 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

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Último (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

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