Maven cannot resolve dependency for module in same multi-module project

The Maven reactor is weird that way, it keeps modules around only for certain tasks. When running a build target that only does something for one subproject, then even if Maven builds dependencies first, it does not keep them around in the reactor (sometimes).

Installing to the local repository is a workaround, but it is horrible and should be avoided when possible, because you can easily end up with outdated build results.

A slightly less ugly workaround is to combine two build targets, where the second build target does something harmless, but triggers addition to reactor in all subprojects.

As an example you can combine the task you want with the 'compile' or 'package' tasks.

Also see highest voted answer at Maven doesn't recognize sibling modules when running mvn dependency:tree


Have you run mvn clean install at least once on the project to install the dependencies within your local repository?