dhrm dhrm - 1 year ago 113
Java Question

How to include dependencies in WAR file?

I've a

Dynamic Web Project
in Eclipse which has a dependency to another Java project in my workspace. When running the web project in the build-in Tomcat server, I've added the project dependency to the class path in the run configuration. I would like to create a WAR for deploying the web project on an external server. The dependency Java project is added to the Java Build path in Eclipse, but when I export an WAR-file the library is not included. The Java project is also selected in the Order and Export. How can I create a WAR with where my dependencies are included?

Answer Source

Maven multimodule project is well suited here,

If you don't want to go for it then just the build the dependency into (.jar) add it to runtime dependency of web project(/WEB-INF/lib) and build up the WAR