Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update-property does not update the property defined in the parent POM #997

Open
marko-bekhta opened this issue Jul 31, 2023 · 1 comment
Labels

Comments

@marko-bekhta
Copy link

Hey all,

We have a use-case for update-property when the property is defined in the parent pom and the corresponding dependency is managed in the module.

As an example, assume having a multimodule maven project:

<?xml version="1.0" encoding="UTF-8"?>
<!--ROOT POM:-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.acme</groupId>
    <artifactId>my-artifact-parent</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>
    <modules>
        <module>module1</module>
    </modules>

    <properties>
        <version.some.lib>1.0.0.Final</version.some.lib>
    </properties>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--Module POM:-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.acme</groupId>
        <artifactId>my-artifact-parent</artifactId>
        <version>1.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>module1</artifactId>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>some</groupId>
                <artifactId>lib</artifactId>
                <version>${version.some.lib}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>

and let's assume there's a 2.0.0.Final version of this lib. Running

mvn versions:update-property -Dproperty=version.some.lib

has no effect on such POMs, since the property lives in a parent and the plugin only considers a current pom file for editing:

} else if (PomHelper.setPropertyVersion(pom, version.getProfileId(), property.getName(), winner.toString())) {

Would it be possible to support such a case and update the property in the parent pom?

@jarmoniuk
Copy link
Contributor

Similar to #837, but in this case the mojo is applied on the reactor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants