• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web App Deployment using Ant

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I'm trying to deploy a web app using Ant.

Development Environment
-------------------------
C:\JavaProjects\MyProj\ directory has the following files/dirs
build.xml (The XML build file)
thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif

Deployment Environment
----------------------------------------
I wanna make a WAR file and copy it to
C:\Tomcat5\webapps\ directory


Here goes my build.xml file
-----------------------------
<?xml version="1.0"?>
<project name="aag" default="compile" basedir=".">

<property name="name" value="aag" />
<property name="build" value="${basedir}/build" />
<property name="dist" value="${basedir}/dist" />
<property name="source" value="${basedir}/src" />
<property name="tomcat" value="C:/Tomcat5/webapps" />

<target name="init" >
<tstamp />
<mkdir dir="${build}" /> Won’t this overrite my bdild directory?
<mkdir dir="${dist}" />
</target>

<target name="compile" depends="init" >
<javac srcdir="${source}" destdir="${build}" />
</target>

<target name="war" depends="compile">
<war destFile="myapp.war"
webxml=" src/metadata/myapp.xml">
<classes dir="build/main"/> <!-- the java classes -->
<fileset dir="src/html/myapp"/>
<fileset dir="src/jsp/myapp"/>

</war>
<copy todir="${tomcat}" file="myapp.war" />
</target>
</project>

I have some Queries:
I hope the location of my build file is correct?
1. Won’t the mkdir task over-write my build directory?
2. I still have to explicitly give the name of my Tomcat Installation directory. Is there any other procedure?

Regards,
SCJP
 
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In brief: 1 - No. 2 - No.

With regard to 1, the easiest way to see this is to simply try it. Though, it's a pity this isn't mentioned in the mkdir task documentation.

With regard to 2, you do need to explicitly copy to your Tomcat directory. I can't think of any other procedure that could be used, can you?

(OK, maybe you could write a Tomcat-specific "deploy"-type task that uses the CATALINA_HOME environment variable, but that seems overly complex to me...)



-Tim
[ July 31, 2005: Message edited by: Tim West ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's another thread running right now which deals with the exact same question.
reply
    Bookmark Topic Watch Topic
  • New Topic