While ArchCC has provided an acceptible workaround to your problem, the main issue here is that you are misunderstanding the modules concept.
Modules are build-time relations, not runtime dependencies (although they usually don't make sense unless they are also referenced as dependencies). A multi-module project lets you perform a complex build in one step, using common configuration. Once the build has occured, the <modules>
block in the deployed pom has no meaning whatsoever, so it's absolutely pointless to specify modules if you don't have them.
If your issue is that you only want to build part of the project then the solution is to use the advanced reactor commands. Here's an excerpt from mvn --help
:
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options:
-am,--also-make If project list is specified, also
build projects required by the
list
-amd,--also-make-dependents If project list is specified, also
build projects that depend on
projects on the list
-pl,--projects <arg> Build specified reactor projects
instead of all projects
-rf,--resume-from <arg> Resume reactor from specified
Examples:
mvn -am -pl api,client/impl
build modules api and client/impl (nested modules work here also) with all their dependencies (in the current tree)
mvn -amd -pl core
build module core and all modules that reference it as a dependency
mvn -rf my/deep/nested/module
resume a reactor build from the specified module (scenario: you have a huge build that fails because of a unit test in the 25th module. so you fix the test and continue from where you are, saving the time of re-building all previous modules)
EDIT: I just realize that your modules are outside the root directory. in my opinion, that is a violation of the maven modules concept, because it breaks the reactor functionality specified above.