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

后端 未结 1 1701
名媛妹妹
名媛妹妹 2020-12-08 22:34

http://maven.apache.org/pom.html#Properties says property \"values are accessible anywhere within a POM\".

Should this read \"are accessible in most places

相关标签:
1条回答
  • 2020-12-08 22:53

    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

    • MNG-624
    0 讨论(0)
提交回复
热议问题