0

i have pom.xml which has parent pom.xml i want to be able to use mvn commands or Linux commands or Jenkins groovy to fetch the value of the tag in the parent. can i tell maven to get all parents from its main pom?
for example

main : pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
  
    <parent>
        <groupId>org.test</groupId>
        <artifactId>my-parent</artifactId>
        <version>1</version>
    </parent>

    <groupId>org.app</groupId>
    <artifactId>my-app</artifactId>
    <version>1</version>
    <packaging>pom</packaging>

     
    <properties>
        
    </properties>


    <dependencyManagement>
        <dependencies>
             
        </dependencies>
    </dependencyManagement>

</project>

then i have the parent:

<?xml version="1.0" encoding="UTF-8"?>
<project ">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.test</groupId>
        <artifactId>my-great-parent</artifactId>
        <version>1</version>
    </parent>

    <artifactId>my-parent</artifactId>
    <version>1</version>
    <packaging>pom</packaging>

    <properties>
        <my.version>2020</my.version>       
    </properties>

</project>

Where i like to get the value of properties.my.version (2020)
Is there any way to do this using mvn commands or Jenkins groovy?

user63898
  • 29,839
  • 85
  • 272
  • 514

0 Answers0