title: Maven 3: Accessing parent.parent.version from grandchild pom
body: <p>I have a problem accessing <strong>parent.parent.version</strong> from grandchild pom.</p>
  
  <p>Here is the exact description of the problem:</p>
  
  <p>Parent pom:</p>
  
  <pre><code>&lt;groupId&gt;com.parent&lt;/groupId&gt;
  &lt;artifactId&gt;parent&lt;/artifactId&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  &lt;version&gt;1.6-SNAPSHOT&lt;/version&gt;
  .
  .
  .
  &lt;properties&gt;
      &lt;child.version&gt;1.3-SNAPSHOT&lt;/child.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>Child pom:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;com.parent&lt;/groupId&gt;
      &lt;artifactId&gt;parent&lt;/artifactId&gt;
      &lt;version&gt;1.6-SNAPSHOT&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;groupId&gt;com.child&lt;/groupId&gt;
  &lt;artifactId&gt;child&lt;/artifactId&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  &lt;version&gt;${child.version}&lt;/version&gt;
  </code></pre>
  
  <p>GrandChild pom:</p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;com.child&lt;/groupId&gt;
      &lt;artifactId&gt;child&lt;/artifactId&gt;
      &lt;version&gt;${child.version}&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;groupId&gt;com.grandchild&lt;/groupId&gt;
  &lt;artifactId&gt;grandchild&lt;/artifactId&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  &lt;version&gt;${project.parent.version}&lt;/version&gt;
  .
  .
  .
  &lt;profiles&gt;
  &lt;plugin&gt;
     &lt;groupId&gt;com.spotify&lt;/groupId&gt;
     &lt;artifactId&gt;docker-maven-plugin&lt;/artifactId&gt;
     &lt;version&gt;1.0.0&lt;/version&gt;
     &lt;configuration&gt;
        &lt;imageName&gt;artifactory:6001/${project.name}:${parent.parent.version}&lt;/imageName&gt;
        &lt;serverId&gt;docker&lt;/serverId&gt;
        &lt;dockerDirectory&gt;${project.basedir}&lt;/dockerDirectory&gt;
        &lt;resources&gt;
           &lt;resource&gt;
              &lt;targetPath&gt;/&lt;/targetPath&gt;
              &lt;directory&gt;${project.build.directory}&lt;/directory&gt;
              &lt;include&gt;${project.build.finalName}.jar&lt;/include&gt;
           &lt;/resource&gt;
        &lt;/resources&gt;
     &lt;/configuration&gt;
     &lt;executions&gt;
        &lt;execution&gt;
           &lt;phase&gt;package&lt;/phase&gt;
           &lt;goals&gt;
              &lt;goal&gt;build&lt;/goal&gt;
           &lt;/goals&gt;
        &lt;/execution&gt;
     &lt;/executions&gt;
  &lt;/plugin&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>Whenever I build this project, I get below exception:</p>
  
  <blockquote>
    <p>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]</p>
  </blockquote>
  
  <p>How do I get parent.parent.version(main project version) from grandchild pom. <br/><strong>Docker version should be same as main project version. Thats the goal for me!!!</strong></p>