8

I have two projects in eclipse, a library project producing a Jar file and a web project dependant on that Jar. How do I get the web project to export the first projects jar in its war automatically. I know this must have been answered before, but I really cant find it.

Thanks,

aronp
  • 799
  • 2
  • 6
  • 14

1 Answers1

19

The mechanism to determine what goes in the war is not the build path as for "normal" applications, but the "Deployment assembly".

Right-click on the root node of the dynamic web project, and select Properties, and select Deployment assembly. Here you can add projects (which are jarred up and added to WEB-INF/lib) and individual jars in the project.


EDIT 2015-08-20: A few years later, Maven has become the standard way to build Java-based software primarily due to the script based approach to dependency management. This includes how to build WAR-files, and the three major IDE's (IntelliJ, Netbeans and Eclipse) fully support this allowing you to switch between IDE's while developing. In Eclipse the problem asked here will not apply, as this is fully controlled by the Maven plugin.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • Thanks, I'm using eclipse 3.5.2 and I cant see that option in any of my projects properties. One of my projects is definitely a dynamic web project, but another is a google app engine project. How can I get that menu option, am I missing a pluggin (or two?). – aronp Jan 07 '11 at 23:50
  • It was renamed in 3.6 to Deployment Assembly. I cannot recall the previous naming. – Thorbjørn Ravn Andersen Jan 08 '11 at 09:05
  • I think it was Java EE Module Dependencies, thanks very much. – aronp Jan 08 '11 at 10:23