File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes  How to deploy war file automatically in tomcat server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark " How to deploy war file automatically in tomcat server" Watch " How to deploy war file automatically in tomcat server" New topic
Author

How to deploy war file automatically in tomcat server

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,

I am able to write ant script(build.xml) for creating war file. Same war file if I deploy manually in the tomcat server it is working.

But my doubt is how to write the script which is automatically deploy in tomcat server after creating war file.

It would be grateful if you have provide me any suggestion/advice for the needful

Thanks and Regards,
Sumanta Panda
Gautam Velpula
Greenhorn

Joined: Aug 04, 2008
Posts: 13
<target name="deploywar" depends="build" description="Deploy application as a WAR file">
<war destfile="${name}.war"
webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</war>
<copy todir="${deploy.path}" preservelastmodified="true">
<fileset dir=".">
<include name="*.war"/>
</fileset>
</copy>
</target>


add a target like this.
Hope this answers your question
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Gautam,

Thanks for your suggestion.

That means in the "{deploy.path}" i have to mention my tomcat path "C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps"

Please confirm.

Thanks for your time.

Regards,
Sumanta


Gautam Velpula
Greenhorn

Joined: Aug 04, 2008
Posts: 13
yes. That is correct
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Sumanta, I would suggest to use the Tomcat Manager http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to deploy war file automatically in tomcat server