I have the following project structure:
Parent
-- Module A
-- Module B
-- Module C
-- Module D
Parent
has the following properties:
<properties>
<ModuleA.version>1.8</ModuleA.version>
</properties>
In module C
, I am specifying dependency of A
, using ${ModuleA.version}
.
Module D
depends on Module C
, which in turn depends on Module A
. Now, when I am running mvn clean install
on Module D
, considering that they share the same parent, I am expecting that the properties defined in parent would be available and hence ModuleA.version
would be resolved to 1.8
and used.
However, the command is failing with the error:
The following artifacts could not be resolved: ModuleA:jar:${ModuleA.version}
Can someone help me with what I am missing here.
In all the modules I am specifying parents correctly.
That is: Module C
and Module D
mentions Module B
as parent. Module B
and Module A
mentions Parent
as parent.
Actual POM's below: Parent:
<groupId>com.dummy</groupId>
<artifactId>parent</artifactId>
<version>0.15-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Parent</name>
<properties> <store-version>0.19-SNAPSHOT</store-version>
<data-version>0.16-SNAPSHOT</data-version>
</properties>
Data POM
<parent>
<groupId>com.dummy</groupId>
<artifactId>parent</artifactId>
<version>0.15-SNAPSHOT</version>
<relativePath>../../parent</relativePath>
Store POM:
<parent>
<groupId>com.dummy</groupId>
<artifactId>parent</artifactId>
<version>0.15-SNAPSHOT</version>
<relativePath>../../parent</relativePath>
</parent>
<dependency>
<groupId>com.dummy</groupId>
<artifactId>data</artifactId>
<version>${data-version}</version>
<scope>compile</scope>
</dependency>
When I use mvn clean install for Store project, it finds Data version and gives no errors.
Source POM
<parent>
<groupId>com.dummy</groupId>
<artifactId>parent</artifactId>
<version>0.15-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>source</artifactId>
<packaging>pom</packaging>
<version>0.6-SNAPSHOT</version>
Source API POM
<parent>
<groupId>com.dummy</groupId>
<artifactId>source</artifactId>
<version>0.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependency>
<groupId>com.dummy</groupId>
<artifactId>store</artifactId>
<version>${store.version}</version>
<scope>compile</scope>
</dependency>
Source API builds fine, finds proper versions.
Source WS
<parent>
<groupId>com.dummy</groupId>
<artifactId>source</artifactId>
<version>0.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependency>
<groupId>com.dummy</groupId>
<artifactId>source-api</artifactId>
<version>${project.version}</version>
</dependency>
When I try to build source-ws, the build fails with error, ${data-version} not found.