mojohaus / versions

Versions Maven Plugin
https://www.mojohaus.org/versions/versions-maven-plugin/
Apache License 2.0
327 stars 265 forks source link

parent profile dependency property is not associated #1085

Open ggkochanski opened 3 weeks ago

ggkochanski commented 3 weeks ago

Profile dependency property, e.g.

<?xml version="1.0" encoding="UTF-8"?>
<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>

    <properties>
        <maven-dependency-plugin.version>3.6.0</maven-dependency-plugin.version>
    </properties>

    <dependencies>
    </dependencies>

    <profiles>
        <profile>
            <id>profile1</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>

is normally updated by command:

$ mvn -Pprofile1 org.codehaus.mojo:versions-maven-plugin:2.16.2:update-properties

[INFO] --- versions:2.16.2:update-properties (default-cli) @ my-artifact-parent ---
[INFO] Updated ${maven-dependency-plugin.version} from 3.6.0 to 3.6.1

But running this command on a child project, e.g.

<?xml version="1.0" encoding="UTF-8"?>
<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-child</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>com.acme</groupId>
        <artifactId>my-artifact-parent</artifactId>
        <version>1.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <maven-dependency-plugin.version>3.6.0</maven-dependency-plugin.version>
    </properties>
</project>

does not update the property.

The expected behavior is that activating parent profile should allow to update properties of those dependencies