I\'m trying to set up a multi-module Maven project, and the inter-module dependencies are apparently not being set up correctly.
I have:
The only thing that workd for me : switching to gradle :(
I have
Parent
+---dep1
+---war1 (using dep1)
and I can just cd in war1 and use mvn tomcat7:run-war. I always have to install the whole project before, despite war1 references his parent and the parent references war1 and dep1 (as modules) so all dependencies should be known.
I don't understand what the problem is.
I think the problem is that when you specify a dependency Maven expects to have it as jar (or whatever) packaged and available from at least a local repo. I'm sure that if you run mvn install
on your commons project first everything will work.
Bonusing off the answer from Don Willis:
If your build creates test-jars to share test code among your reactor submodules you should use:
mvn test-compile dependency:tree
which will allow dependency:tree
to run to completion in this case.
Make sure the module which is failing gets resolved in the pom, is pointing to the right parent by including the configurations in the pom file of the module.
As discussed in this maven mailing list thread, the dependency:tree goal by itself will look things up in the repository rather than the reactor. You can work around this by mvn installing, as previously suggested, or doing something less onerous that invokes the reactor, such as
mvn compile dependency:tree
Works for me.
for me, what led me to this thread was a similar problem and the solution was to ensure all module dependency pom's had
<packaging>pom</packaging>
the parent had
pom
my model dep had pom - so there was no jar to be found.