You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Rik Schaaf (JIRA)" <ji...@apache.org> on 2019/01/25 15:55:00 UTC

[jira] [Comment Edited] (MNG-6578) revision property not resolved when the root module isnt the ancestor of a submodule

    [ https://issues.apache.org/jira/browse/MNG-6578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16752369#comment-16752369 ] 

Rik Schaaf edited comment on MNG-6578 at 1/25/19 3:54 PM:
----------------------------------------------------------

I have a feeling that it is not a bug per se, but just a feature that maven is lacking.

I also found a thread on stackoverflow that asks for a similar feature (passing on properties through aggregation in general):
https://stackoverflow.com/questions/31487982/how-to-specify-maven-properties-in-a-aggregator-pom
On that thread the answers are quite unsatisfying, probably because there doesnt seem to be a way to do this yet.


was (Author: rikschaaf):
I have a feeling that it is not a bug per se, but just a feature that maven is lacking.

I also found a thread on stackoverflow that asks for a similar feature (passing on properties through aggregation in general):
https://stackoverflow.com/questions/31487982/how-to-specify-maven-properties-in-a-aggregator-pom
On that thread the answers are quite unsatisfying

> 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
>
> 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)