aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Creating WAR file directories (maintain fullpath) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Creating WAR file directories (maintain fullpath)" Watch "Creating WAR file directories (maintain fullpath)" New topic
Author

Creating WAR file directories (maintain fullpath)

Bob Robertson
Greenhorn

Joined: May 16, 2004
Posts: 17
Hello,

I've searched the web, this BB, and apache's site and still have not found my answer so I thought I would take a stab at posting a question.

I am trying to create a WAR file that includes directories that would reside as peers to the WEB-INF directory. Using the WAR task this works fine for classes and the lib directory, but not for special folders that are necessary like a folder I have called config or templates.

Using the fileset tag, I can get the contents of the directories in the WAR, but not the actual directory with its contents which is what I need. I

I noticed that the TAR task had a fullpath attrbiute that allowed for this, but I can't find docs on a similar jarfileset tag that supports this.

What I have resorted to is copying the necessary folders to my project's web folder, setting web as the basdir, and war'ing from there (using jar task). I then delete the copied folders so I don't have double the space taken up.

Can someone tell me a leaner way to script this build?

Thanks in advance!

br
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16228
    
  21

In this era of ultrafat disks, worrying about duplicates simply isn't worth it. I've taken to making the "web" directory in my projects be an exact image of my static content, then as part of the build process, copy it into the build/webapp directory (which is also the recipient of the IDE's compiles/Ant compiles). So I have a compile step, a copy step and an WAR step. The build/webapp directory as of the time the WAR step would be executed is an exploded WAR suitable for direct use by Tomcat, so I only actually have to WAR when I'm ready to make a distro.

When a project is finished, I run Ant clean to wipe away the build directory. I have "build" listed as an entry in .cvsignore, so it doesn't waste space in the source code repository.

Done properly, you only have duplications when duplications are useful.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating WAR file directories (maintain fullpath)