title: Share maven plugin configuration between build and reporting sections
body: <p>I have a maven project where I use several plugins (pmd, checkstyle) in the build and in the reporting section of the <code>pom.xml</code>. The former for enforcing several constraints and the latter for the site report. These invocations of the plugins mostly share common <code>&lt;configuration&gt;</code> elements and so far the only solution I found is to copy the respective XML fragments. Is there any way to avoid this duplication?</p>
  
  <p>Example <code>pom.xml</code> fragments:</p>
  
  <pre><code>&lt;project ...&gt;
  ...
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${plugin.pmd.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;targetJdk&gt;${target.java.version}&lt;/targetJdk&gt;
                      &lt;rulesets&gt;
                          &lt;ruleset&gt;${project.basedir}/codecheck/pmd-rules.xml&lt;/ruleset&gt;
                      &lt;/rulesets&gt;
                      &lt;excludeRoots&gt;
                          &lt;excludeRoot&gt;${project.basedir}/target/generated-sources/protobuf/java&lt;/excludeRoot&gt;
                      &lt;/excludeRoots&gt;
                      &lt;failOnViolation&gt;${failOnStyleError}&lt;/failOnViolation&gt;
                      &lt;verbose&gt;true&lt;/verbose&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;pmd-check&lt;/id&gt;
                          &lt;phase&gt;validate&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;check&lt;/goal&gt;
                              &lt;goal&gt;cpd-check&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  ...
      &lt;reporting&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
                  &lt;version&gt;${plugin.pmd.version}&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;targetJdk&gt;${target.java.version}&lt;/targetJdk&gt;
                      &lt;rulesets&gt;
                          &lt;ruleset&gt;${project.basedir}/codecheck/pmd-rules.xml&lt;/ruleset&gt;
                      &lt;/rulesets&gt;
                      &lt;excludeRoots&gt;
                          &lt;excludeRoot&gt;${project.basedir}/target/generated-sources/protobuf/java&lt;/excludeRoot&gt;
                      &lt;/excludeRoots&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/reporting&gt;
  ...
  </code></pre>