다중 모듈 Maven-3 프로젝트가 있는데, 다른 모든 모듈에서 서브 모듈 중 하나가 <dependency>
으로 사용됩니다. 동시에 모든 하위 모듈은 상위 모듈에서 상속받습니다. 이러한 구조는 주기적 종속성을 초래합니다. 어떻게 해결할 수 있습니까?보조 Maven 서브 모듈의 주기적 종속성을 해결하는 방법은 무엇입니까?
프로젝트 구조는 오히려 전형적인 :
[...]
<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
/foo-testkit
/foo-core
이 부모 foo/pom.xml
입니다. 하지만 foo
에서 상속받은 하위 모듈 인 foo-testkit
에서 checkstyle을 실행할 필요는 없지만 동시에 종속성이 있습니다.
내가 이해하는 한, 감사의 말로는 두 가지 옵션 만 사용할 수 있습니다. 첫 번째 코드는 많은'pom.xml' 파일에서 코드 중복을 일으키지 않으므로보다 효과적입니다 (12 개의 하위 모듈이 있습니다) – yegor256