title: Inheriting configuration property from parent pom in maven
body: <p>I am trying to fiddle with maven antrun plugin.
  I have a parent pom and child pom. I want to maven-install child pom and have some custom properties that are specified in parent pom to be included in the jar manifest. I want to do this with maven-antrun plugin.</p>
  
  <p>This is what I have done:</p>
  
  <ol>
  <li>I have included ant jar task in parent pom. That ant jar task specifies properties to be added to the manifest. </li>
  <li>I have also added dummy echo tasks in both parent and child poms. </li>
  <li>I am hoping that child pom should inherit parent tasks (both echo and jar). For this I have same execution id <code>&lt;id&gt;execution-1&lt;/id&gt;</code> in both child and parent pom. Also child pom task have <code>combine.children="append"</code></li>
  </ol>
  
  <p><strong>parent-pom.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.abc.xyz&lt;/groupId&gt;
      &lt;artifactId&gt;parent-pom&lt;/artifactId&gt;
      &lt;version&gt;2.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
  
      &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;execution-1&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;run&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;tasks&gt;
                              &lt;echo&gt;from parent pom!!!&lt;/echo&gt;
  
                              &lt;jar destfile="${project.build.directory}/${project.build.finalName}.jar"
                                  basedir="src/main"&gt;
                                  &lt;manifest&gt;
                                      &lt;attribute name="Class-Path" value="mahesh" /&gt;
                                      &lt;attribute name="Main-Class" value="com.abc.xyz.Application" /&gt;
                                      &lt;attribute name="Build-Jdk" value="${java.version}" /&gt;
                                      &lt;attribute name="Built-By" value="${user.name}" /&gt;
                                  &lt;/manifest&gt;
                              &lt;/jar&gt;​
                          &lt;/tasks&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>child-pom.xml</strong></p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;artifactId&gt;sample-project&lt;/artifactId&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;com.abc.xyz&lt;/groupId&gt;
          &lt;artifactId&gt;parent-pom&lt;/artifactId&gt;
          &lt;version&gt;2.0.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
      &lt;build&gt;
      &lt;finalName&gt;sample-project&lt;/finalName&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;execution-1&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;run&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;tasks combine.children="append"&gt; 
                              &lt;echo&gt;from child pom!!!&lt;/echo&gt; 
                          &lt;/tasks&gt; 
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sample-project ---
  [INFO] Building jar: D:\Mahesh\workspaces\workspace2\sample-project\target\sample-project.jar
  [INFO] 
  [INFO] --- maven-antrun-plugin:1.3:run (execution-1) @ sample-project ---
  [INFO] Executing tasks
       [echo] from parent pom!!!
       [echo] from child pom!!!
  [INFO] Executed tasks
  [INFO] 
  [INFO] --- maven-install-plugin:2.4:install (default-install) @ sample-project ---
  [INFO] Installing D:\Mahesh\workspaces\workspace2\sample-project\target\sample-project.jar to D:\MavenRepo\repository\com\abc\xyz\sample-project\2.0.0-SNAPSHOT\sample-project-2.0.0-SNAPSHOT.jar
  [INFO] Installing D:\Mahesh\workspaces\workspace2\sample-project\pom.xml to D:\MavenRepo\repository\com\abc\xyz\sample-project\2.0.0-SNAPSHOT\sample-project-2.0.0-SNAPSHOT.pom
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  </code></pre>
  
  <p><strong>Manifest contents</strong></p>
  
  <pre><code>Manifest-Version: 1.0
  Archiver-Version: Plexus Archiver
  Built-By: 593932
  Created-By: Apache Maven 3.3.9
  Build-Jdk: 1.8.0_71
  </code></pre>
  
  <p>Note that the manifest content does not have</p>
  
  <pre><code>Class-Path: mahesh
  </code></pre>
  
  <p>which is specified in parent pom.</p>
  
  <p><strong>Doubts</strong></p>
  
  <ol>
  <li>Since <code>Class-path:mahesh</code> is not getting added to the manifest, it is clear that jar is not getting generated by antrun task specified in parent pom. Also it can be seen in the first line of the "Output", jar seems to have generated by maven-jar-plugin but not by the antrun-plugin. Inside antrun-plugin I am getting only two echoes. I feel I should get building jar output inside antrun-task start end  only. Why its not working? </li>
  <li>Is this right way to do this (adding property values specified in parent pom to jar manifest). I feel I shouldn't have jar task in parent pom, but should be in child pom and that jar task should access property specified in parent pom. Is their any standard / more correct / preferrable way to do this?</li>
  </ol>