SlideShare une entreprise Scribd logo
1  sur  8
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 1/8
Codin | Home | Previous | 01 | End
ANT - Build Tool
# ANT Example1:
HelloWorld.java
packageco.rakshit;
publicclassHelloWorld{
publicstaticvoidmain(String[]args){
System.out.println("WelcometoANT");
}
}
build.xml
<projectname="HelloWorld"default="run">
<targetname="compile">
<mkdirdir="co/rakshit"/>
<javacsrcdir="."destdir="."/>
<echo>Compilationisdone</echo>
</target>
<targetname="package"depends="compile">
<jardestfile="HelloWorld.jar"basedir="."
includes="co/rakshit/*.class"/>
</target>
<targetname="run"depends="package">
<javaclassname="co.rakshit.HelloWorld">
<classpath>
<pathelementlocation="."/>
</classpath>
</java>
<echo>Executionisdone</echo>
</target>
</project>
Download this example
Download .jar files
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 2/8
# ANT Example2:
Note: use the HelloWorld.java from previous example
build.xml
<projectname="HelloWorld"default="run">
<propertyname="classes.dir"value="build/classes"/>
<propertyname="target.dir"value="target"/>
<propertyname="project.name"value="HelloWorld"/>
<targetname="clean">
<deletedir="${classes.dir}"/>
<deletedir="${target.dir}"/>
</target>
<targetname="init"depends="clean">
<mkdirdir="${classes.dir}"/>
<mkdirdir="${target.dir}"/>
</target>
<targetname="compile"depends="init">
<mkdirdir="${classes.dir}/co/rakshit"/>
<javacsrcdir="src"destdir="${classes.dir}"/>
<echo>Compilationisdone</echo>
</target>
<targetname="package"depends="compile">
<jardestfile="${target.dir}/${project.name}.jar"
basedir="${classes.dir}"/>
<echo>packageisdone</echo>
</target>
<targetname="run"depends="package">
<javaclassname="co.rakshit.HelloWorld">
<classpath>
<pathelement
location="${target.dir}/${project.name}.jar"/>
</classpath>
</java>
<echo>Executionisdone</echo>
</target>
</project>
Download this example
Download .jar files
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 3/8
# ANT Example3:
Note: use the HelloWorld.java from previous example
build.xml
<projectname="HelloWorld"default="run">
<propertyfile="build.properties"/>
<targetname="clean">
<deletedir="${classes.dir}"/>
<deletedir="${target.dir}"/>
</target>
<targetname="init"depends="clean">
<mkdirdir="${classes.dir}"/>
<mkdirdir="${target.dir}"/>
</target>
<targetname="compile"depends="init">
<mkdirdir="${classes.dir}/co/rakshit"/>
<javacsrcdir="src"destdir="${classes.dir}"/>
<echo>Compilationisdone</echo>
</target>
<targetname="package"depends="compile">
<jardestfile="${target.dir}/${project.name}.jar"
basedir="${classes.dir}"/>
<echo>packageisdone</echo>
</target>
<targetname="run"depends="package">
<javaclassname="co.rakshit.HelloWorld">
<classpath>
<pathelement
location="${target.dir}/${project.name}.jar"/>
</classpath>
</java>
<echo>Executionisdone</echo>
</target>
</project>
build.properties
classes.dir=build/classes
target.dir=target
project.name=HelloWorld
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 4/8
Download this example
# ANT Example4:
Note: Before run below example, we need to copy servlet-api.jar file from tomcat
into our project "WEB-INFlib" folder.
build.xml
<projectname="WebANT"default="war">
<propertyfile="build.properties"/>
<!--defineclasspathjars-->
<pathid="compile.classpath">
<filesetdir="${web.lib.dir}">
<includename="*.jar"/>
</fileset>
</path>
<targetname="init"depends="clean">
<mkdirdir="${build.classes.dir}"/>
<mkdirdir="${dist.dir}"/>
</target>
<targetname="clean">
<deletedir="${build.classes.dir}"/>
<deletedir="${dist.dir}"/>
</target>
<targetname="compile"depends="init">
<javacsrcdir="src"destdir="${build.classes.dir}">
<classpathrefid="compile.classpath"/>
</javac>
<echo>Compilationisdone</echo>
</target>
<targetname="war"depends="compile">
<wardestfile="${dist.dir}/${project.name}.war"
webxml="${web.dir}/WEB-INF/web.xml">
<filesetdir="${web.dir}"/>
<libdir="${web.lib.dir}"/>
<classesdir="${build.classes.dir}"/>
</war>
<echo>packageisdone</echo>
</target>
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 5/8
</project>
build.properties
web.dir=WebContent
web.lib.dir=${web.dir}/WEB-INF/lib
build.classes.dir=builds/classes
dist.dir=dist
project.name=LoginApplication
HelloWorld.java
importjava.io.*;
importjavax.servlet.*;
publicclassHelloWorldextendsGenericServlet{
publicvoidservice(ServletRequestreq,ServletResponseres)throws
ServletException,IOException{
res.setContentType("text/html");
res.getWriter().print("<h1>HelloWorld</h1>");
}
}
web.xml
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
Download this example
# ANT Example5:
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 6/8
Note: use HelloWorld.java, web.xml from previous example.
Note: Before run below example, we need to copy servlet-api.jar and catalina-ant.jar
files from tomcat into our project "WEB-INFlib" folder.
Step 1: Tomcat Authentication
-First add an user with adminstrator access right for Tomcat. To add Tomcat user, edit
this file - "%TOMCAT_PATH%/conf/tomcat-users.xml".
tomcat-users.xml
<?xmlversion='1.0'encoding='utf-8'?>
<tomcat-users>
<rolerolename="manager"/>
<rolerolename="admin"/>
<userusername="admin"password="password"
roles="admin,manager"/>
</tomcat-users>
build.xml
<projectname="LoginApplication"default="war">
<propertyfile="build.properties"/>
<!--defineclasspathjars-->
<pathid="compile.classpath">
<filesetdir="${web.lib.dir}">
<includename="*.jar"/>
</fileset>
</path>
<targetname="init"depends="clean">
<mkdirdir="${build.classes.dir}"/>
<mkdirdir="${dist.dir}"/>
</target>
<targetname="clean">
<deletedir="${build.classes.dir}"/>
<deletedir="${dist.dir}"/>
</target>
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 7/8
<targetname="compile"depends="init">
<javacsrcdir="src"destdir="${build.classes.dir}">
<classpathrefid="compile.classpath"/>
</javac>
<echo>Compilationisdone</echo>
</target>
<targetname="war"depends="compile">
<wardestfile="${dist.dir}/${project.name}.war"
webxml="${web.dir}/WEB-INF/web.xml">
<filesetdir="${web.dir}"/>
<libdir="${web.lib.dir}"/>
<classesdir="${build.classes.dir}"/>
</war>
<echo>packageisdone</echo>
</target>
<targetname="tomcat-start"depends="war">
<javajar="${tomcat.home}/bin/bootstrap.jar"fork="true">
<jvmargvalue="-Dcatalina.home=${tomcat.home}"/>
<argline="start"/>
</java>
</target>
<targetname="tomcat-stop">
<javajar="${tomcat.home}/bin/bootstrap.jar"fork="true">
<jvmargvalue="-Dcatalina.home=${tomcat.home}"/>
<argline="stop"/>
</java>
</target>
<targetname="deploy-tomcat"description="deploytotomcat"
depends="tomcat-start">
<echo>deployingfromclient</echo>
<deployurl="${tomcat-manager-url}"username="${tomcat-
manager-username}"password="${tomcat-manager-password}"
path="/${project.name}"war="file:./${dist.dir}/${project.name}.war"/>
<echo>Applicationsuccessfullydeployed</echo>
</target>
<targetname="undeploy"description="undeploying">
<echo>undeployingfromclient</echo>
<undeployurl="${tomcat-manager-url}"username="${tomcat-
manager-username}"password="${tomcat-manager-password}"
path="/${project.name}"/>
</target>
<taskdefname="start"classname="org.apache.catalina.ant.StartTask">
<classpath>
<pathelementlocation="${web.lib.dir}catalina-
ant.jar"/>
</classpath>
</taskdef>
<taskdefname="stop"classname="org.apache.catalina.ant.StopTask">
<classpath>
<pathelementlocation="${web.lib.dir}catalina-
ant.jar"/>
</classpath>
6/6/13 ANT - Build Tool
file:///D:/codin/ant/ant01.html 8/8
</taskdef>
<taskdefname="deploy"
classname="org.apache.catalina.ant.DeployTask">
<classpath>
<pathelementlocation="${web.lib.dir}catalina-
ant.jar"/>
</classpath>
</taskdef>
<taskdefname="undeploy"
classname="org.apache.catalina.ant.UndeployTask">
<classpath>
<pathelementlocation="${web.lib.dir}catalina-
ant.jar"/>
</classpath>
</taskdef>
</project>
build.properties
web.dir=WebContent
web.lib.dir=${web.dir}/WEB-INF/lib
build.classes.dir=builds/classes
dist.dir=dist
project.name=LoginApplication
tomcat.home=D:/dev/tomcat6
tomcat-manager-url=http://localhost:8080/manager
tomcat-manager-username=rohit
tomcat-manager-password=rohit
Download this example
Codin | Home | Previous | Index | End
© Rohit Rakshit

Contenu connexe

Tendances

PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2Graham Dumpleton
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersDavid Rodenas
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forCorneil du Plessis
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareAlona Mekhovova
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
Reactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsReactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsGabor Varadi
 
Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16Benny Neugebauer
 
State management in android applications
State management in android applicationsState management in android applications
State management in android applicationsGabor Varadi
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/ServletSunil OS
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance DjangoDjangoCon2008
 
Make use of Sonar for your mobile developments - It's easy and useful!
Make use of Sonar for your mobile developments - It's easy and useful!Make use of Sonar for your mobile developments - It's easy and useful!
Make use of Sonar for your mobile developments - It's easy and useful!cyrilpicat
 
What’s new in Android JetPack
What’s new in Android JetPackWhat’s new in Android JetPack
What’s new in Android JetPackHassan Abid
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqelajobandesther
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIsRemy Sharp
 

Tendances (20)

Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
 
Basic Tutorial of React for Programmers
Basic Tutorial of React for ProgrammersBasic Tutorial of React for Programmers
Basic Tutorial of React for Programmers
 
Spring 4 - A&BP CC
Spring 4 - A&BP CCSpring 4 - A&BP CC
Spring 4 - A&BP CC
 
Gradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting forGradle: The Build system you have been waiting for
Gradle: The Build system you have been waiting for
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
Reactive state management with Jetpack Components
Reactive state management with Jetpack ComponentsReactive state management with Jetpack Components
Reactive state management with Jetpack Components
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 
Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16
 
State management in android applications
State management in android applicationsState management in android applications
State management in android applications
 
Paging Like A Pro
Paging Like A ProPaging Like A Pro
Paging Like A Pro
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
High Performance Django
High Performance DjangoHigh Performance Django
High Performance Django
 
Lviv 2013 d7 vs d8
Lviv 2013   d7 vs d8Lviv 2013   d7 vs d8
Lviv 2013 d7 vs d8
 
Make use of Sonar for your mobile developments - It's easy and useful!
Make use of Sonar for your mobile developments - It's easy and useful!Make use of Sonar for your mobile developments - It's easy and useful!
Make use of Sonar for your mobile developments - It's easy and useful!
 
What’s new in Android JetPack
What’s new in Android JetPackWhat’s new in Android JetPack
What’s new in Android JetPack
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 

En vedette

Cloud computing
Cloud computingCloud computing
Cloud computingAli Bahu
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMATAli Bahu
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To AntRajesh Kumar
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat ToolKanika2885
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best PracticesMaidul Islam
 
Highly efficient container orchestration and continuous delivery with DC/OS a...
Highly efficient container orchestration and continuous delivery with DC/OS a...Highly efficient container orchestration and continuous delivery with DC/OS a...
Highly efficient container orchestration and continuous delivery with DC/OS a...Christian Bogeberg
 
Apache Ant
Apache AntApache Ant
Apache AntAli Bahu
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache MavenMudit Gupta
 
Apache Ant
Apache AntApache Ant
Apache AntAli Bahu
 
LatJUG Java Build Tools
LatJUG Java Build ToolsLatJUG Java Build Tools
LatJUG Java Build ToolsDmitry Buzdin
 
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211Ji-Woong Choi
 
Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools­Avishek A
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache AntShih-Hsiang Lin
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011Ching Yi Chan
 

En vedette (20)

Cloud computing
Cloud computingCloud computing
Cloud computing
 
Hadoop
HadoopHadoop
Hadoop
 
Subversion (SVN)
Subversion (SVN)Subversion (SVN)
Subversion (SVN)
 
EclipseMAT
EclipseMATEclipseMAT
EclipseMAT
 
Introduction To Ant
Introduction To AntIntroduction To Ant
Introduction To Ant
 
Ant - Another Neat Tool
Ant - Another Neat ToolAnt - Another Neat Tool
Ant - Another Neat Tool
 
SVN Tool Information : Best Practices
SVN Tool Information  : Best PracticesSVN Tool Information  : Best Practices
SVN Tool Information : Best Practices
 
Highly efficient container orchestration and continuous delivery with DC/OS a...
Highly efficient container orchestration and continuous delivery with DC/OS a...Highly efficient container orchestration and continuous delivery with DC/OS a...
Highly efficient container orchestration and continuous delivery with DC/OS a...
 
Apache ANT
Apache ANTApache ANT
Apache ANT
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
ANT
ANTANT
ANT
 
Apache ANT vs Apache Maven
Apache ANT vs Apache MavenApache ANT vs Apache Maven
Apache ANT vs Apache Maven
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
LatJUG Java Build Tools
LatJUG Java Build ToolsLatJUG Java Build Tools
LatJUG Java Build Tools
 
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211
[오픈소스컨설팅]애플리케이션 빌드 및_배포가이드_v1.0_20140211
 
Java Build Tools
Java Build ToolsJava Build Tools
Java Build Tools
 
Apache maven 2 overview
Apache maven 2 overviewApache maven 2 overview
Apache maven 2 overview
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Java Build Tool course in 2011
Java Build Tool course in 2011Java Build Tool course in 2011
Java Build Tool course in 2011
 

Similaire à Ant build tool2

OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overviewBalduran Chang
 
การเข ยนโปรแกรมต ดต_อฐานข_อม_ล
การเข ยนโปรแกรมต ดต_อฐานข_อม_ลการเข ยนโปรแกรมต ดต_อฐานข_อม_ล
การเข ยนโปรแกรมต ดต_อฐานข_อม_ลBongza Naruk
 
A re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbaiA re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbaiPraveen Puglia
 
A I R Presentation Dev Camp Feb 08
A I R  Presentation  Dev Camp  Feb 08A I R  Presentation  Dev Camp  Feb 08
A I R Presentation Dev Camp Feb 08Abdul Qabiz
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Tino Isnich
 
JavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンJavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンharuki ueno
 
IzPack at LyonJUG'11
IzPack at LyonJUG'11IzPack at LyonJUG'11
IzPack at LyonJUG'11julien.ponge
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257newegg
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the FinishYehuda Katz
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 

Similaire à Ant build tool2 (20)

OSGi framework overview
OSGi framework overviewOSGi framework overview
OSGi framework overview
 
การเข ยนโปรแกรมต ดต_อฐานข_อม_ล
การเข ยนโปรแกรมต ดต_อฐานข_อม_ลการเข ยนโปรแกรมต ดต_อฐานข_อม_ล
การเข ยนโปรแกรมต ดต_อฐานข_อม_ล
 
Dart Workshop
Dart WorkshopDart Workshop
Dart Workshop
 
A re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbaiA re introduction to webpack - reactfoo - mumbai
A re introduction to webpack - reactfoo - mumbai
 
A I R Presentation Dev Camp Feb 08
A I R  Presentation  Dev Camp  Feb 08A I R  Presentation  Dev Camp  Feb 08
A I R Presentation Dev Camp Feb 08
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01Gradleintroduction 111010130329-phpapp01
Gradleintroduction 111010130329-phpapp01
 
JavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオンJavaDo#09 Spring boot入門ハンズオン
JavaDo#09 Spring boot入門ハンズオン
 
Demystifying Maven
Demystifying MavenDemystifying Maven
Demystifying Maven
 
Apache Ant
Apache AntApache Ant
Apache Ant
 
Build Scripts
Build ScriptsBuild Scripts
Build Scripts
 
IzPack at LyonJUG'11
IzPack at LyonJUG'11IzPack at LyonJUG'11
IzPack at LyonJUG'11
 
Mini curso Android
Mini curso AndroidMini curso Android
Mini curso Android
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Augeas @RMLL 2012
Augeas @RMLL 2012Augeas @RMLL 2012
Augeas @RMLL 2012
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 

Dernier

Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptxraviapr7
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17Celine George
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxKatherine Villaluna
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE
 
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdf
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdfNOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdf
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdfSumit Tiwari
 
Latin American Revolutions, c. 1789-1830
Latin American Revolutions, c. 1789-1830Latin American Revolutions, c. 1789-1830
Latin American Revolutions, c. 1789-1830Dave Phillips
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
How to Filter Blank Lines in Odoo 17 Accounting
How to Filter Blank Lines in Odoo 17 AccountingHow to Filter Blank Lines in Odoo 17 Accounting
How to Filter Blank Lines in Odoo 17 AccountingCeline George
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17Celine George
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxDr. Asif Anas
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17Celine George
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
How to Print Employee Resume in the Odoo 17
How to Print Employee Resume in the Odoo 17How to Print Employee Resume in the Odoo 17
How to Print Employee Resume in the Odoo 17Celine George
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 

Dernier (20)

Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024
 
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdf
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdfNOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdf
NOTES OF DRUGS ACTING ON NERVOUS SYSTEM .pdf
 
Latin American Revolutions, c. 1789-1830
Latin American Revolutions, c. 1789-1830Latin American Revolutions, c. 1789-1830
Latin American Revolutions, c. 1789-1830
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
How to Filter Blank Lines in Odoo 17 Accounting
How to Filter Blank Lines in Odoo 17 AccountingHow to Filter Blank Lines in Odoo 17 Accounting
How to Filter Blank Lines in Odoo 17 Accounting
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 
How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17How to Show Error_Warning Messages in Odoo 17
How to Show Error_Warning Messages in Odoo 17
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptx
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17How to Add a New Field in Existing Kanban View in Odoo 17
How to Add a New Field in Existing Kanban View in Odoo 17
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
How to Print Employee Resume in the Odoo 17
How to Print Employee Resume in the Odoo 17How to Print Employee Resume in the Odoo 17
How to Print Employee Resume in the Odoo 17
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 

Ant build tool2

  • 1. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 1/8 Codin | Home | Previous | 01 | End ANT - Build Tool # ANT Example1: HelloWorld.java packageco.rakshit; publicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println("WelcometoANT"); } } build.xml <projectname="HelloWorld"default="run"> <targetname="compile"> <mkdirdir="co/rakshit"/> <javacsrcdir="."destdir="."/> <echo>Compilationisdone</echo> </target> <targetname="package"depends="compile"> <jardestfile="HelloWorld.jar"basedir="." includes="co/rakshit/*.class"/> </target> <targetname="run"depends="package"> <javaclassname="co.rakshit.HelloWorld"> <classpath> <pathelementlocation="."/> </classpath> </java> <echo>Executionisdone</echo> </target> </project> Download this example Download .jar files
  • 2. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 2/8 # ANT Example2: Note: use the HelloWorld.java from previous example build.xml <projectname="HelloWorld"default="run"> <propertyname="classes.dir"value="build/classes"/> <propertyname="target.dir"value="target"/> <propertyname="project.name"value="HelloWorld"/> <targetname="clean"> <deletedir="${classes.dir}"/> <deletedir="${target.dir}"/> </target> <targetname="init"depends="clean"> <mkdirdir="${classes.dir}"/> <mkdirdir="${target.dir}"/> </target> <targetname="compile"depends="init"> <mkdirdir="${classes.dir}/co/rakshit"/> <javacsrcdir="src"destdir="${classes.dir}"/> <echo>Compilationisdone</echo> </target> <targetname="package"depends="compile"> <jardestfile="${target.dir}/${project.name}.jar" basedir="${classes.dir}"/> <echo>packageisdone</echo> </target> <targetname="run"depends="package"> <javaclassname="co.rakshit.HelloWorld"> <classpath> <pathelement location="${target.dir}/${project.name}.jar"/> </classpath> </java> <echo>Executionisdone</echo> </target> </project> Download this example Download .jar files
  • 3. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 3/8 # ANT Example3: Note: use the HelloWorld.java from previous example build.xml <projectname="HelloWorld"default="run"> <propertyfile="build.properties"/> <targetname="clean"> <deletedir="${classes.dir}"/> <deletedir="${target.dir}"/> </target> <targetname="init"depends="clean"> <mkdirdir="${classes.dir}"/> <mkdirdir="${target.dir}"/> </target> <targetname="compile"depends="init"> <mkdirdir="${classes.dir}/co/rakshit"/> <javacsrcdir="src"destdir="${classes.dir}"/> <echo>Compilationisdone</echo> </target> <targetname="package"depends="compile"> <jardestfile="${target.dir}/${project.name}.jar" basedir="${classes.dir}"/> <echo>packageisdone</echo> </target> <targetname="run"depends="package"> <javaclassname="co.rakshit.HelloWorld"> <classpath> <pathelement location="${target.dir}/${project.name}.jar"/> </classpath> </java> <echo>Executionisdone</echo> </target> </project> build.properties classes.dir=build/classes target.dir=target project.name=HelloWorld
  • 4. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 4/8 Download this example # ANT Example4: Note: Before run below example, we need to copy servlet-api.jar file from tomcat into our project "WEB-INFlib" folder. build.xml <projectname="WebANT"default="war"> <propertyfile="build.properties"/> <!--defineclasspathjars--> <pathid="compile.classpath"> <filesetdir="${web.lib.dir}"> <includename="*.jar"/> </fileset> </path> <targetname="init"depends="clean"> <mkdirdir="${build.classes.dir}"/> <mkdirdir="${dist.dir}"/> </target> <targetname="clean"> <deletedir="${build.classes.dir}"/> <deletedir="${dist.dir}"/> </target> <targetname="compile"depends="init"> <javacsrcdir="src"destdir="${build.classes.dir}"> <classpathrefid="compile.classpath"/> </javac> <echo>Compilationisdone</echo> </target> <targetname="war"depends="compile"> <wardestfile="${dist.dir}/${project.name}.war" webxml="${web.dir}/WEB-INF/web.xml"> <filesetdir="${web.dir}"/> <libdir="${web.lib.dir}"/> <classesdir="${build.classes.dir}"/> </war> <echo>packageisdone</echo> </target>
  • 5. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 5/8 </project> build.properties web.dir=WebContent web.lib.dir=${web.dir}/WEB-INF/lib build.classes.dir=builds/classes dist.dir=dist project.name=LoginApplication HelloWorld.java importjava.io.*; importjavax.servlet.*; publicclassHelloWorldextendsGenericServlet{ publicvoidservice(ServletRequestreq,ServletResponseres)throws ServletException,IOException{ res.setContentType("text/html"); res.getWriter().print("<h1>HelloWorld</h1>"); } } web.xml <web-app> <servlet> <servlet-name>hello</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>hello</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app> Download this example # ANT Example5:
  • 6. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 6/8 Note: use HelloWorld.java, web.xml from previous example. Note: Before run below example, we need to copy servlet-api.jar and catalina-ant.jar files from tomcat into our project "WEB-INFlib" folder. Step 1: Tomcat Authentication -First add an user with adminstrator access right for Tomcat. To add Tomcat user, edit this file - "%TOMCAT_PATH%/conf/tomcat-users.xml". tomcat-users.xml <?xmlversion='1.0'encoding='utf-8'?> <tomcat-users> <rolerolename="manager"/> <rolerolename="admin"/> <userusername="admin"password="password" roles="admin,manager"/> </tomcat-users> build.xml <projectname="LoginApplication"default="war"> <propertyfile="build.properties"/> <!--defineclasspathjars--> <pathid="compile.classpath"> <filesetdir="${web.lib.dir}"> <includename="*.jar"/> </fileset> </path> <targetname="init"depends="clean"> <mkdirdir="${build.classes.dir}"/> <mkdirdir="${dist.dir}"/> </target> <targetname="clean"> <deletedir="${build.classes.dir}"/> <deletedir="${dist.dir}"/> </target>
  • 7. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 7/8 <targetname="compile"depends="init"> <javacsrcdir="src"destdir="${build.classes.dir}"> <classpathrefid="compile.classpath"/> </javac> <echo>Compilationisdone</echo> </target> <targetname="war"depends="compile"> <wardestfile="${dist.dir}/${project.name}.war" webxml="${web.dir}/WEB-INF/web.xml"> <filesetdir="${web.dir}"/> <libdir="${web.lib.dir}"/> <classesdir="${build.classes.dir}"/> </war> <echo>packageisdone</echo> </target> <targetname="tomcat-start"depends="war"> <javajar="${tomcat.home}/bin/bootstrap.jar"fork="true"> <jvmargvalue="-Dcatalina.home=${tomcat.home}"/> <argline="start"/> </java> </target> <targetname="tomcat-stop"> <javajar="${tomcat.home}/bin/bootstrap.jar"fork="true"> <jvmargvalue="-Dcatalina.home=${tomcat.home}"/> <argline="stop"/> </java> </target> <targetname="deploy-tomcat"description="deploytotomcat" depends="tomcat-start"> <echo>deployingfromclient</echo> <deployurl="${tomcat-manager-url}"username="${tomcat- manager-username}"password="${tomcat-manager-password}" path="/${project.name}"war="file:./${dist.dir}/${project.name}.war"/> <echo>Applicationsuccessfullydeployed</echo> </target> <targetname="undeploy"description="undeploying"> <echo>undeployingfromclient</echo> <undeployurl="${tomcat-manager-url}"username="${tomcat- manager-username}"password="${tomcat-manager-password}" path="/${project.name}"/> </target> <taskdefname="start"classname="org.apache.catalina.ant.StartTask"> <classpath> <pathelementlocation="${web.lib.dir}catalina- ant.jar"/> </classpath> </taskdef> <taskdefname="stop"classname="org.apache.catalina.ant.StopTask"> <classpath> <pathelementlocation="${web.lib.dir}catalina- ant.jar"/> </classpath>
  • 8. 6/6/13 ANT - Build Tool file:///D:/codin/ant/ant01.html 8/8 </taskdef> <taskdefname="deploy" classname="org.apache.catalina.ant.DeployTask"> <classpath> <pathelementlocation="${web.lib.dir}catalina- ant.jar"/> </classpath> </taskdef> <taskdefname="undeploy" classname="org.apache.catalina.ant.UndeployTask"> <classpath> <pathelementlocation="${web.lib.dir}catalina- ant.jar"/> </classpath> </taskdef> </project> build.properties web.dir=WebContent web.lib.dir=${web.dir}/WEB-INF/lib build.classes.dir=builds/classes dist.dir=dist project.name=LoginApplication tomcat.home=D:/dev/tomcat6 tomcat-manager-url=http://localhost:8080/manager tomcat-manager-username=rohit tomcat-manager-password=rohit Download this example Codin | Home | Previous | Index | End © Rohit Rakshit