Search code examples
mavenmaven-3maven-plugin

Import maven property from another pom


How can versions from the properties section be exported in another pom.xml file? Import the version of "third.party.dep.version" from the FIRST project into the SECOND project. The scope import will only make accessible all dependencies from the pom of this project (it won't help me).

I can't use parent pom.xml

The first pom.xml:

<parent>
    <groupId>com.p</groupId>
    <artifactId>parentpom</artifactId>
    <version>1</version>
</parent>

<groupId>org.example</groupId>
<artifactId>FIRST</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
        <third.party.dep.version>1.0</third.party.dep.version>
</properties>

The second pom.xml

<parent>
    <groupId>com.p</groupId>
    <artifactId>parentpom</artifactId>
    <version>1</version>
</parent>

<groupId>org.example</groupId>
<artifactId>SECOND</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
        <!--IMPORT here third.party.dep.version-->
</properties>

Solution

  • This is not possible.

    You can only inherit properties from parent POMs.