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

Add multiple files in WEB-INF of war

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ali Qanavatian
Greenhorn
Posts: 1
Java Linux Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Henderson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why not use the webinf element. This works for me.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic