Maven 2.2.1의 자식 프로젝트에서 (부모) pom.xml
의 의존성을 상속 받고 싶습니다. 즉 프로젝트 상속을 사용합니다. 이 경우 기본 포장 유형을 jar
에서 pom
으로 변경해야합니다.프로젝트 집계 (멀티 모듈)를 사용하지 않을 때 패키징 유형 'pom'이 필요합니까?
그러나 the Maven2 documentation 상태는 포장 유형 pom
즉 서브 모듈을 사용하여 멀티 모듈 프로젝트가 아닌 프로젝트 상속, 프로젝트 통합에 필요한 것을하지 않는 이유는 무엇입니까? 다음 항목으로, 다른 한편
Project ID: example:example-child
Reason: Parent: example:example-parent:jar:1
of project: example:example-child has wrong packaging: jar.
Must be 'pom'. for project example:example-child
: 위의 구성으로 메이븐 (예를 mvn clean
) 호출하면
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example-parent</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
</project>
<project>
<parent>
<groupId>example</groupId>
<artifactId>example-parent</artifactId>
<version>1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example-child</artifactId>
</project>
는, 당신은 오류가
<project>
...
<packaging>pom</packaging>
...
</project>
부모 pom.xml
에 Maven을 오류없이 실행할 수 있습니다.
Maven의이 동작이 올바른가요? POM Reference의 Inheritance 섹션에 설명 된대로