有一个多模块 Maven-3 项目,其中一个子模块与<dependency>
所有其他模块一样使用。同时,所有子模块都继承自父模块。这样的结构导致循环依赖。我该如何解决?
项目结构比较典型:
/foo
/foo-testkit
/foo-core
这是父母foo/pom.xml
:
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle/checks.xml</configLocation>
</configuration>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>foo-testkit</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
在父foo/pom.xml
级中,我指定了在每个子模块中必须如何以及何时执行 checkstyle 插件。但是我不需要在中执行 checkstyle foo-testkit
,这是一个继承自的子模块foo
,但同时也是一个依赖项..