4

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.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347

3 Answers3

3

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
  • 8,542
  • 8
  • 45
  • 69
1

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

tddmonkey
  • 20,798
  • 10
  • 58
  • 67
0

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.

Community
  • 1
  • 1
kgiannakakis
  • 103,016
  • 27
  • 158
  • 194