Maven - how to set parent version in submodule

I want to install version for all modules in the main module.

The main module:

<groupId>com.myproject</groupId>
<artifactId>myproject-main-module</artifactId>
<version>${myproject.version}</version>
<packaging>pom</packaging>

<properties>
   <myproject.version>3.1.0-SNAPSHOT</myproject.version>
   <myproject.parent.version>1.1</myproject.parent.version>
</properties>

      

Submodule:

<groupId>com.myproject</groupId>
<artifactId>myproject-submodule</artifactId>
<packaging>pom</packaging>

<parent>
   <groupId>com.myproject</groupId>
   <artifactId>myproject-main-module</artifactId>
   <version>${myproject.version}</version>
</parent>

      

Why is $ {myproject.version} not considered a submodule and what should I do if I want to install the version only once for all modules.

+3


source to share





All Articles