versions
versions copied to clipboard
`update-property` does not update the property defined in the parent POM
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: https://github.com/mojohaus/versions/blob/6cd759ce2b1e884ebbbf3dece70b156d1b102753/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsUpdaterMojo.java#L476
Would it be possible to support such a case and update the property in the parent pom?
Similar to #837, but in this case the mojo is applied on the reactor.