I created a bunch of projects in Eclipse 3.7.2. Let some of them be called:
- W (dynamic web project)
- A (some library)
- B (a library with many common things that is also used by other projects)
Project A depends on project B, so B is on the build path of A. Project W depends on project A, so I added A as a deployment build in W.
When I export a WAR from Eclipse, only the JAR file for A is added to WEB-INF / lib. Eclipse shows the following warning:
The pathpath / B element will not be exported or published. runtime This can lead to the appearance of ClassNotFoundExceptions.
The warning is true. I get ClassNotFoundExceptions at runtime. Of course, Eclipse provides a quick fix for the warning, which is “Mark the associated source class path entry as a publish / export dependency”. However, this does not fix my problem. B still does not deploy with W.
I tried manually adding B as a deployment assembly in A. This includes B.jar in A.jar, which is not what I want, and I still get ClassNotFoundExceptions.
The only thing that works is to manually add B as the deployment assembly in W. Eclipse still shows a warning from above, but there is no runtime exception.
Am I missing something or is this really the only way to get this to work?
source share