aspose file tools
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
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Add multiple files in WEB-INF of war" Watch "Add multiple files in WEB-INF of war" New topic
Author

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.


$Hi/\bEr
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 4489

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: 11740

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.


A lot the of modern-day software development platforms are designed to permit parcelling out work to those with the best aptitude for it. A lot of modern-day business is predicated on making one person do all the work, regardless of aptitude.
Ali Qanavatian
Greenhorn

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:
+any-dir
     +WEB-INF
        <xml-files-are-here>

that's how i did it.

This message was edited 2 times. Last update was at by Ali Qanavatian



who is this guy anyway?
Michael Henderson
Greenhorn

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

This message was edited 1 time. Last update was at by Michael Henderson

 
 
subject: Add multiple files in WEB-INF of war
 
developer file tools