有一个多模块的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插件。但是我不需要在foo-testkit
中执行checkstyle,它是继承自foo
的子模块,但同时也是一个依赖项。