jQuery in Action, 3rd edition
The moose likes Ant, Maven and Other Build Tools and the fly likes Add multiple files in WEB-INF of war 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 "Add multiple files in WEB-INF of war" Watch "Add multiple files in WEB-INF of war" New topic

Add multiple files in WEB-INF of war

Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
My dev structure doesnt have a WEB-INF directory. How can i add multiple files other than web.xml to WEB-INF directory of the war?

I want to do this using the ant script.

Peter Johnson

Joined: May 14, 2008
Posts: 5852

Use the <copy> task?

Personally, I follow the Maven build pattern - I first gather the contents of the WAR in a single directory location, then I package up the whole directory. That way I have both a packaged WAR file and an "exploded" WAR directory.

JBoss In Action
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Second on Peter's suggestion.

I did learn a LONG time ago that it's best to make project directories either read-only or write-only, regardless of the build system you're using. I normally build an exploded WAR and feed that directly to Tomcat for debugging, then jar up the exploded WAR when I want to make a distribution module. In keeping with not having permanent files in an output directory, I copy them from a static file source directory (or directories) into the exploded WAR directory when I do a build, just as I compile to the exploded WAR's WEB-INF/classes directory.

An IDE is no substitute for an Intelligent Developer.
Ali Qanavatian

Joined: Mar 29, 2011
Posts: 1

ant does not allow using <copy> in <war> block, you may use

in your ant file. and then just create a "WEB-INF" directory in "any-dir" directory, and put xml files there.
the directory structure would be like this:

that's how i did it.

who is this guy anyway?
Michael Henderson

Joined: Feb 22, 2011
Posts: 2
why not use the webinf element. This works for me.

I agree. Here's the link: http://aspose.com/file-tools
subject: Add multiple files in WEB-INF of war
It's not a secret anymore!