I have a problem accessing parent.parent.version from grandchild pom.
Here is the exact description of the problem:
Parent pom:
<groupId>com.parent</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.6-SNAPSHOT</version>
.
.
.
<properties>
<child.version>1.3-SNAPSHOT</child.version>
</properties>
Child pom:
<parent>
<groupId>com.parent</groupId>
<artifactId>parent</artifactId>
<version>1.6-SNAPSHOT</version>
</parent>
<groupId>com.child</groupId>
<artifactId>child</artifactId>
<packaging>pom</packaging>
<version>${child.version}</version>
GrandChild pom:
<parent>
<groupId>com.child</groupId>
<artifactId>child</artifactId>
<version>${child.version}</version>
</parent>
<groupId>com.grandchild</groupId>
<artifactId>grandchild</artifactId>
<packaging>pom</packaging>
<version>${project.parent.version}</version>
.
.
.
<profiles>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>artifactory:6001/${project.name}:${parent.parent.version}</imageName>
<serverId>docker</serverId>
<dockerDirectory>${project.basedir}</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</profile>
Whenever I build this project, I get below exception:
Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default) on project grandchild: Exception caught: The template variable 'parent.parent.version' has no value -> [Help 1]
How do I get parent.parent.version(main project version) from grandchild pom.
Docker version should be same as main project version. Thats the goal for me!!!
${project.version}
and use it in the child work? – Botulism${project.version}
in the Parent pom. When maven build starts, it builds grandchild first and that populates docker.version to${project.version}
. Here project is the current project which is the grandchild and so the docker.version will be 1.3-SNAPSHOT. – Nobby