2015-01-10 1 views
0

Maven이 이상한 사용 사례를 건드리고 있습니다. & 왜 그런 식으로 행동하는지 궁금합니다.Maven 플러그인 종속성은 부모 pom 속성을 사용할 수 없습니다.

내가 지금처럼 내 부모 프로젝트의 속성을 정의하고 있습니다 :

<build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>bob</artifactId> 
       <version>1.0.0.0</version> 
       <dependencies> 
        <dependency> 
         <groupId>org.example</groupId> 
         <artifactId>example</artifactId> 
         <version>${some.property.version}</artifactId> 
        </dependency> 
       </dependencies> 
      </plugin> 
     </plugins> 
    </build> 

:

<properties> 
     <some.property.version>1.0.0.0</some.property.version> 
    </properties> 

을 이제, 모듈, 정말 같은 플러그인에 대한 종속성의 버전을 설정 이로 인해 Maven에서 오류가 발생합니다 :

[ERROR] org.example에 대해 [ERROR] 'build.plugins.plugin [org.apache.maven.plugins : bob] .dependencies.dependency.version': 예 : jar가 있어야합니다. 유효한 버전이지만 '$ {some.p roperty.version} '. @ line 350, column 16

내게 기괴한 것은 내가 정의한 속성을 모듈 자체로 옮기면 Maven이 잘 컴파일된다는 것입니다. 이거 버그 야? 아니면 모듈 용 플러그인에서 부모 pom 속성에 대한 가시성이 제한되어 있습니까?

+0

두 번째 생각에 이것은 아마도 메일 링리스트에 가장 적합 할 것입니다 ... 나중에 Maven 사람들의 피드백으로이를 업데이트 할 것입니다! – gordysc

답변

0

아파치 메이븐 (Apache Maven) 메일 그룹의 엄청난 빠른 응답! 부모 pom이 리팩토링되었고, 모듈은 부실 부모의 artifactId를 가리키고있었습니다. Robert에 대한 명성!

Hi,

This makes me wonder if the "right" parent is used, so please double check the groupId, artifactId and version. If both parent and module are part of the same multi-module, be sure that the relativePath is correct (defaults to ../pom.xml) You could also use "mvn org.apache.maven.plugins:maven-help-plugin:2.2:effective-pom" to verify that the property is really there with the expected value. If this is all as expected, then it seems to be a bug.

thanks, Robert

+1

명예의 Thnx –

+0

@RobertScholte 플러그인의 종속성을 부모가 관리하고있는 경우 프로젝트 종속성을 위해 버전을 지정하지 않고 지정할 수 있습니다. ch.qos.logback에 대해''build.plugins.plugin [com.mysema.querydsl : querydsl-maven-plugin] .dependencies.dependency.version '을 시도하면 플러그인 의존성이 해결되지 않습니다 : logback-classic : jar is missing . @ line 95, column 18' –

+0

Maven이 빌드를 시작하기 전에 사용 된 모든 플러그인을 완전히 해결해야합니다. 따라서 프로젝트 종속성을 플러그인 종속성으로 사용할 수 없으며 단순히 다른 용도로 사용됩니다. –

관련 문제