views:

1047

answers:

3

I need to have a JEE project generate a WAR file automatically - preferrably exploded - as opposed to choosing Export -> War file.

I have played with the various server defintions but have not been able to get either the JEE 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 JEE, 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).

+1  A: 

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.

Pablojim
The problem with ant is that it is not aware of the Eclipse metadata. I would like to have Eclipse do it, to ensure that the WAR I would export manually would be identical to what I get automatically.
Thorbjørn Ravn Andersen
Eclipse meta-data is now accessed with ant4eclipse, which unfortunately is a bit fragile but works well enough for us.
Thorbjørn Ravn Andersen
A: 

You should be able to do this with "File" -> "Export", scroll down to "Web" -> "WAR File" and follow the instructions

MrWiggles
This is what I do today - see the question - but I want Eclipse to do it for me.
Thorbjørn Ravn Andersen
A: 

Have a look at this question. It refers to 3.2 version, but I believe that it still holds, until up to 3.4 version at least. It seems there is no automatic way of doing the Export - War thing.

Consider the solution given by Pablojim and drop the Export facility.

kgiannakakis