1
我有一个父母和孩子pom。父母定义了一些配置文件:子模块不继承从父pom配置文件
<profiles>
<profile>
<id>local</id>
<properties>
<build.profile.id>local</build.profile.id>
</properties>
</profile>
</profiles>
然后孩子们为这些配置文件定义更多属性。
<profiles>
<profile>
<id>local</id>
<properties>
<name>serviceA</name>
</properties>
</profile>
</profiles>
如果我只叫孩子轮廓mvn help:effective-pom -pl child
父定义的属性不显示。它只显示孩子一个,所以父母不知何故被遗忘。
有没有什么办法可以继承父母,并在孩子中修改/扩展?
编辑1:可能的答案 我发现this link他们说:
不幸的是,父POM继承有一定的限制。其中之一是配置文件不会被继承。
所以也许这是不可能的。你们有什么感想?这些年有什么变化吗?
编辑2:属性在某种程度上
继承通过运行MVN帮助:有效-POM -Plocal我得到
...
<properties>
<build.profile.id>local</build.profile.id>
<name>serviceA</name>
</properties>
<profiles>
<profile>
<id>local</id>
<properties>
<name>serviceA</name>
</properties>
</profile>
</profiles>
所以我想只有性能似乎在某种程度上继承。
我喜欢你的解决方案。我还注意到属性是从父pom继承的,也就是说,如果我在父级配置文件下定义一个属性,那么在调用子级时,该属性也会作为“全局”属性继承。只要看看我的Edit2。 – jlanza