Skip to content

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

Closed

Description

@marko-bekhta

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?

Activity

  1. andrzejj0 commented on Feb 24, 2024

    @andrzejj0
    Contributor

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

  2. added
    bug
    on Feb 24, 2024
  3. github-actions commented on Feb 24, 2025

    @github-actions

    This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.

  4. dmatthijssen commented on Feb 26, 2025

    @dmatthijssen

    This is still relevant, we have loads of multi-module projects and this issue makes the update-property unusable.

  5. github-actions commented on Feb 27, 2026

    @github-actions

    This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days.

  6. marko-bekhta commented on Feb 27, 2026

    @marko-bekhta
    Author

    would still like to see this one addressed at some point 🙂 🤞🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions