将财产放在父pom上并将其引用在您的孩子pom
上似乎是一种不好的做法例如
on parent pom.xml
<my.related.version>3.3.0.ga</my.related.version>
on myproject/pom.xml
<dependency>
<groupId>my.related</groupId>
<artifactId>my.related</artifactId>
<version>${my.related.version}</version>
</dependency>
当您在Maven存储库上安装和部署myproject并在工作区之外的第二个项目中引用它时,您可以" crox"
无法转移伪像 我的合作:我的划分:pom:$ {my.releated.version}
我不知道为什么?
如何解决?注意:问题与
有关- maven-在没有真实解释的存储库中安装project.pom文件中的属性。
- http://jira.codehaus.org/browse/mng-2971?
它已在最近的Maven版本上解决了吗?哪个是最佳实践?
最佳实践是在父 pom.xml
中配置dependencyManagement
<dependencyManagement>
<dependency>
<groupId>my.related</groupId>
<artifactId>my.related</artifactId>
<version>${my.related.version}</version>
</dependency>
</dependencyManagement>
和 dependency
myproject/pom.xml
<dependency>
<groupId>my.related</groupId>
<artifactId>my.related</artifactId>
</dependency>
更多信息:依赖机制简介