[
https://issues.apache.org/jira/browse/MNG-6578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Scholte updated MNG-6578:
--------------------------------
Labels: consumer-pom (was: )
> revision property not resolved when the root module isnt the ancestor of a
> submodule
> ------------------------------------------------------------------------------------
>
> Key: MNG-6578
> URL: https://issues.apache.org/jira/browse/MNG-6578
> Project: Maven
> Issue Type: New Feature
> Affects Versions: 3.5.0, 3.6.0
> Reporter: Rik Schaaf
> Priority: Major
> Labels: consumer-pom
>
> Consider the following structure:
> There is an external parent pom (lets call it external:ext-pom:1.0)
> In my project I have the following module structure:
> {code:java}
> rootmodule
> |_submodule-bom
> |_submodule-parent
> |_submodule-child
> {code}
> These are the contents of the poms:
> rootmodule/pom.xml:
> {code:java}
> <parent>
> <groupId>external</groupId>
> <artifactId>ext-pom</artifactId>
> <version>1.0</version>
> </parent>
> <groupId>demo</groupId>
> <artifactId>rootmodule</artifactId>
> <version>${revision}</version>
> <packaging>pom</packaging>
> <modules>
> <module>submodule-child</module>
> <module>submodule-parent</module>
> </modules>
> <properties>
> <revision>1.0.0-SNAPSHOT</revision>
> </properties>
> <build>
> <plugins>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>flatten-maven-plugin</artifactId>
> ...
> {code}
> submodule-parent/pom.xml:
> {code:java}
> <parent>
> <groupId>external</groupId>
> <artifactId>ext-pom</artifactId>
> <version>1.0</version>
> </parent>
> <groupId>demo</groupId>
> <artifactId>submodule-parent</artifactId>
> <version>${revision}</version>
> <packaging>pom</packaging>
> {code}
> submodule-child/pom.xml:
> {code:java}
> <parent>
> <groupId>demo</groupId>
> <artifactId>submodule-parent</artifactId>
> <version>${revision}</version>
> <relativePath>../submodule-parent</relativePath>
> </parent>
> <artifactId>submodule-child</artifactId>
> <packaging>pom</packaging>
> {code}
> When building the rootmodule with {noformat}mvn clean install{noformat}
> I get the following build log:
> {code:java}
> [INFO] Reactor Summary:
> [INFO]
> [INFO] submodule-parent ${revision} ....................... SUCCESS [ 0.025
> s]
> [INFO] submodule-child ${revision} ........................ SUCCESS [ 1.024
> s]
> [INFO] rootmodule 1.0.0-SNAPSHOT ........... SUCCESS [ 0.493 s]
> {code}
> Note how the versions of the child and parent aren't defined, because they
> aren't a direct or indirect child of the root module. Also the created jar
> files now have as version null.
> I know that you can supply the commandline variable -Drevision=1.0.0-SNAPSHOT
> or put it in the .mvn/maven.config file, but I would prefer to be able to set
> the version number in the pom instead.
> Since ${revision} is a specially treated variable, it would be nice if the
> revision property (and the 2 other accompanying properties) would be
> inherited by submodules, even if they do not have the project root as an
> ancestor.
> Alternatively it could be implemented by being able to specify in the
> <modules> section that you want to propagate properties to the submodules,
> like for instance:
> {code}
> <modules>
> <inheritProperties>true</inheritProperties>
> <module>submodule-child</module>
> <module>submodule-parent</module>
> </modules>
> {code}
> Either solution or a different solution alltogether would be fine.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)