Maven: property substitution not done for /project/version tag of pom?

蓝咒 提交于 2019-11-28 06:56:15

Property substitution is not allowed in /project/parent/(groupId|artifactId|version) or in /project/(groupId|artifactId|version) by design in Maven 2.x.

So the rules are:

  • hard code the version in the top project/version element.
  • hard code the version in the project/parent/version element of children.
  • children inherit the version unless they want to override it
    • there is thus not need for a ${myversion} property
  • use ${project.groupId} and ${project.version} for inter module dependencies.

You'll find an infinite number of threads on this topic on the maven user list (see for example Pom Parent Version Properties) and I'll just say that any attempt to workaround the above rules is wrong and doesn't work.

Version less parent will be allowed in Maven 3.1.

See also

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!