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

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 

Dernier (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.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