我有以下maven项目的树结构:
Root/pom.xml
Root/moduleA/pom.xml
Root/moduleA/src/main/java/moduleA/MyClass.java
我想通过 exec-maven 插件在 Root pom.xml 中使用类 moduleA.MyClass。问题是:如果我将 ModuleA 定义为 pom xml 的模块
Root/pom.xml
<modules>
<module>moduleA</module>
</modules>
我不能将它声明为 Root 的依赖项
Root/pom.xml
<dependencies>
<dependency>
<groupId>Root</groupId>
<artifactId>moduleA</artifactId>
<version>1.0</version>
<scope>install</scope>
</dependency>
</dependencies>
因为它会导致这样的循环依赖:
[INFO] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='Root:moduleA'}' and 'Vertex{label='Root:moduleA'}' introduces to cycle in the graph Root:moduleA --> Root:moduleA
问题是:如何保持install
在 Root pom 上执行目标构建的 moduleA并能够使用 exec-maven-plugin 执行 moduleA 的类?