I'm creating a multi-module project with a flat hierarchy in Eclipse:
¦ myproject-parent ¦ - pom.xml ¦ myproject ¦ - pom.xml ¦ myproject-dep ¦ - pom.xml
With the parent pom having references to the two modules, myproject
has myproject-dep
in its dependencies and both have 开发者_开发知识库the parent noted. The project and subproject dependencies are complete in the web/WEB-INF/lib
folder for Tomcat.
myproject
is a (dynamic) web project with compiled classes going to myproject/web/WEB-INF/classes
, while the dependency project's classes go into myproject-dep/target/classes
. myproject
is run on Tomcat and myproject-dep
is a required project on the build path.
In this situation, I would expect all the dependencies to be in order but the Catalina class loader can't find myproject-dep
's classes. If I add these to the tomcat classpath explicitly in the run configurations then it fails by not finding jar's from myproject-dep
that are clearly present in the webapps's lib folder.
What have I missed here? Thanks!
You say that you are building with maven, but it doesn't sound like you are packaging your war with maven.
If you were using the maven-war-plugin, it would already pull your declared dependencies into the war when it goes through the packaging phase. This also assumes that the dependencies have a properly declared scope, which in your case sounds like the default of compile.
精彩评论