Maven - Accessing Parent Pump Child Properties

In a project structure with multiple modules

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

      

If I have the following properties in parent.pom

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

      

How can I access parent pump properties from any of the baby pumps? I tried this on a baby pump but it didn't work.

  <groupId>com.test</groupId>
  <artifactId>moduleA</artifactId>
  <version>${moduleA.version}</version>

      

+3


source to share


2 answers


If you have a real multi-module build, you should never define modules for different versions. They should have the same version that allows possible other things to be released. Otherwise, you shouldn't use a multi-module setup than using separate separate modules that are separate.



+3


source


This should work. One possible reason I can think of is that perhaps you don't actually inherit from the pom where these properties are defined (i.e. they are not defined as yours <parent>

directly or indirectly), but you have only the main pump that brings your projects together. However, this is an assumption.



+1


source







All Articles