File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant and War file 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 "Ant and War file" Watch "Ant and War file" New topic

Ant and War file

Zach Young

Joined: Nov 15, 2005
Posts: 8
I'm really new to java and have a few questions.

Can ant be used to deploy a war file?

I have readed that a build.xml file must be created can this be used to deploy a web app?
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Yes. You don't have to use Ant, you could use an IDE. Ant has tasks to perform all the steps required to build and deploy a web app. I'd advise you learn these steps (for whatever web container you are using) manually though before automating this process with Ant. Learning one new technology at a time is easier than trying to learn them all at once.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Aruneesh Salhotra
Ranch Hand

Joined: May 12, 2004
Posts: 167
This is how to create a war file for a webapp.
<war destfile="${webapps.dir}/ROOT.war" webxml="${webapps.dir}/ROOT/WEB-INF/web.xml">
<fileset dir="${webapps.dir}/ROOT" excludes="**/web.xml"/>

To Deploy to app servers, there are plugins available, as standard or addon to ANT, that can be used.
They are simple as Tomcat, deploy war="ROOT.war" host="HOSTNAME".
I agree. Here's the link:
subject: Ant and War file
It's not a secret anymore!