11

I am currently working on a Java EE project. I have successfully developed a web service and deployed it under the build-in Apache server of Eclipse, for test purpose.

I have now split my project into 2 projects : A master one and a dependency one (let's say "Utils"). When developing, eclipse doesn't complain about compilation problems, since I have added the "Utils" project as a dependency in my "build path" setup.

However, when launching Tomcat (as a embedded server), it complains about not finding the classes of "Utils" project.

I was expecting eclipse to copy the "Utils/bin" into WebContent/WEb-INF/classes, but it does not. How do I automate that ? So that "Utils/bin" gets deployed into the WebFolder whenever a change occurs ?

FYI, I do not use Maven yet (but I plan to).

Thanks in advance for your help, Kind regards,

Raphael

2 Answers 2

14

Ross' answer put me on the right track, but in Eclipse Helios I couldn't find the Java EE Module in my dynamic web project.

Instead I found the way to add dependencies so they are built into the correct location was under the project's Properties -> Deployment Assembly, and from there I could add archives via path variable, from the file system, or from the workspace, as well as from a folder, a build path entry, or another project.

2
  • +1 I can't believe this. I spent 3-4 hours debugging and it turned out something broke on the deployment assembly page; I deleted and re-added my dependency and things work again.
    – ashes999
    Jun 7, 2014 at 10:30
  • I've actually spent the last couple of years (!) thinking the only way to add another project as dependency to my web application was to export the .JAR file to WEB-INF/lib folder manually, or use Maven or something similar (which im not familiar with). My life just changed, thank you!
    – birgersp
    Aug 9, 2015 at 14:16
5

You can do this by adding the Utils project as a module to your 'Master' project. I assume the master project is a web or ear application. Right click on the project -> properties -> Java EE module Dependencies. Add the Utils project to it. Eclipse will include the Utils project in the deployment.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.