Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant and War file

 
Zach Young
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>
</war>

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".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic