Agregate Project 1:
<groupId>com.mycompany</groupId>
<artifactId>builder</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../module-1</module>
<module>../module-2</module>
</modules>
<properties>
<project.parent.pom>../builder-v1/pom.xml</project.parent.pom>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lib.version>2.5.1</lib.version>
</properties>
Agregate Project 2:
<groupId>com.mycompany</groupId>
<artifactId>builder</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../module-1</module>
<module>../module-4</module>
<module>../module-6</module>
</modules>
<properties>
<project.parent.pom>../builder-v2/pom.xml</project.parent.pom>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lib.version>2.6.0</lib.version>
</properties>
Module 1:
<parent>
<groupId>com.mycompany</groupId>
<artifactId>builder</artifactId>
<version>1.0.0</version>
<relativePath>../builder-v1/pom.xml</relativePath>
<!--<relativePath>${project.parent.pom}</relativePath> not work-->
</parent>
<groupId>com.mycompany</groupId>
<artifactId>module-1</artifactId>
Section relativePath with variable from aggregate pom not work
<relativePath>../builder-v1/pom.xml</relativePath>
<!--<relativePath>${project.parent.pom}</relativePath> not work-->
But I need diffrent ${lib.version} in aggregate projects. If I delete inheritance part from Module 1:
<!--<parent>
<groupId>com.mycompany</groupId>
<artifactId>builder</artifactId>
<version>1.0.0</version>
<relativePath>../builder-v1/pom.xml</relativePath>
</parent>-->
<groupId>com.mycompany</groupId>
<artifactId>module-1</artifactId>
Variables are not passed to the child modules and i got error:
'dependencies.dependency.version' for com.somelib:some-lib:jar must be a valid version but is '${lib.version}'.
How can I configure aggregate project and transfer variables into modules?
UPDATE with @Gab comments
Parent pom:
<groupId>com.mycompany</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<profiles>
<profile>
<id>v1</id>
<activation>
<property>
<name>project.type</name>
<value>v1</value>
</property>
</activation>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lib.version>2.5.1</lib.version>
</properties>
</profile>
...
</profiles>
Module 1:
<parent>
<groupId>com.mycompany</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.mycompany</groupId>
<artifactId>module-1</artifactId>
Agregate Project 1:
<groupId>com.mycompany</groupId>
<artifactId>builder-v1</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<modules>
<module>../module-1</module>
<module>../module-2</module>
</modules>
When execute builder-v1 goals activate profile project.type=v1:
mvn clean package --file=pom_v1.xml -Dproject.type=v1 -Dproject.main.module=module-1