Java – How to have Eclipse Java EE automatically generate the exploded WAR for a web project

eclipsejakarta-eejava

I need to have a Java EE project generate a WAR file automatically – preferably exploded – as opposed to choosing Export -> War file.

I have played with the various server definitions but have not been able to get either the Java EE preview or the HTTP server to work, and before installing each of the external container specific servers I'd like to hear if anybody has made this work.

So, question is: Which steps to take to have a WAR deployment automatically created and maintained by Eclipse?


EDIT: This is Eclipse 3.5 Java EE, and it is a Dynamic Web project in Eclipse. I want the WAR file/tree to be easily copyable to a network drive to be accessible for the target host. It runs an embedded Jetty, but I am interested in the generic WAR.

MyEclipse can do this, but we are standardizing on plain Eclipse.


EDIT: This particular web application will run inside an embedded Jetty. Since this question was asked we have found empirically that we need to have the complete tree containing the application with embedded Jetty, war file (exploded) and all built by the Hudson server in order to avoid human steps in the build-deploy-process. The answer for us therefore is scripting with ant (using ant4eclipse).


EDIT 2012: The ant4eclipse approach proved to be generally too inflexible and fragile in the long run, so we have switched to Maven. This solved very many problems, this one included.

Best Solution

Make an ant task to build the war (and copy if you like). Then add an Ant builder to the project (project -> properties -> builders). As long as your project is configured to build automatically the war will always be upto date.

This would equally work with maven, or pretty much any other build tool.