I am working on my little OSS project in which I am using Maven as build tool. I split the project into smaller sub-projects to simplify development. Thus I have following structure:
project
+-- main-module
| |
| +- pom.xml
|
+-- submodule1
| |
| +- pom.xml
|
+ pom.xml
My thought was that main-module
should provide interfaces which each submodule should be implementing in order to be plugged into whole application. Therefore submodule1/pom.xml
contains compile time dependency reference to main-module
. In its turn I also need to be able to test whole application and thus main-module/pom.xml
contains test scope dependency reference to submodule1
. As the result maven refuses to compile projects saying that they contain cyclic references.
My thought was that maven could first compile classes of main-module
as it does not require any compile time dependency on any of submodules, then it using compiled classes of main-module
could compile classes of submodule1
and after that compile test classes of main-module
(to be able run tests). But seems that maven compiler does not take in account the scope of dependency and I somehow need to work around that.
The only solution I can see is to move away tests from main-module
, which doesn't really make sense for me as only that module provides main logic.
My question - is there any other way around this issue except for moving away tests? Or maybe something is wrong with my understanding of how maven-reactor-plugin should work?