Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - Access properties on parent pom from a child pom

In a multi module project structure as

myApp
|-moduleA
|---pom.xml
|-moduleB
|---pom.xml
|-pom.xml

If i have the following properties in the parent.pom

  <properties>
   <moduleA.version>4.67</moduleA.version>
   <moduleB.version>4.68</moduleB.version>
  </properties>  

How can i access the properties in the parent pom from any of the child poms? I tried this on the child pom but it didnt work.

  <groupId>com.test</groupId>
  <artifactId>moduleA</artifactId>
  <version>${moduleA.version}</version>
like image 649
ziggy Avatar asked Sep 15 '25 03:09

ziggy


1 Answers

If you have a real multi-module build you should never define the modules to have different versions. They should have the same version which make releasing possible and other things as well. Otherwise you should not use the multi-module setup than use simple single modules which are separated.

like image 138
khmarbaise Avatar answered Sep 17 '25 12:09

khmarbaise