build - Maven - How/Why/Should it work to set the parent version to be based on a property defined in the parent pom? -
i have following pom structures:
/home/projects/parent/pom.xml
<project> <groupid>com.my.group</groupid> <artifactid>project-super-parent</artifactid> <version>${major.version}.${minor.version}</version> <packaging>pom</packaging> <properties> <major.version>7</major.version> <minor.version>5</minor.version> <current.release.version>${major.version}.${minor.version}-snapshot</current.release.version> ... </properties> .... </project>
/home/projects/module1/pom.xml
<project> <groupid>com.my.group</groupid> <artifactid>module1</artifactid> <version>${current.release.version}</version> <packaging>jar</packaging> <parent> <groupid>com.my.group</groupid> <artifactid>project-super-parent</artifactid> <version>${major.version}.${minor.version}</version> <relativepath>../parent</relativepath> </parent> ... </project>
notice module not know version of it's parent - uses property defined in parent, kind of chicken & egg problem.
the weird thing - works - when want change major version of product - change single pom file (the parent).
the limitations solution have have pom files on file system.
my questions are: should work? how work? stop working when upgrade maven 3? commonly used solution or abuse of system?
currently using maven 2.2.1 , java 7.
is commonly used solution or abuse of system?
that not common, @ least have never seen before. versioning have in parent/pom.xml , module1/pom.xml cause confusion. parent has released version of 7.5, while module1 has snapshot version of 7.5. should not developing 7.5-snapshot if 7.5 released.
the simplest way avoid duplication maintain version only in parent. can omit version declaration in module1. take project, e.g. maven-3 source code example. able see the version declared in parent pom, , not in of child poms.
maven-release-plugin handle version upgrade , release them you.
Comments
Post a Comment