title: Augmenting instead of overriding Maven configuration
body: <p>I saw <a href="https://stackoverflow.com/questions/1101462/adding-additional-resources-to-a-maven-pom">this question</a> and it motivated me to look again (without success) at Maven configurations for an alternative way of declaring configuration so it is appended to the parent POM's config instead of overriding it.
  In a Maven POM, if configuration declares the same elements as in the parent it overrides the parents configuration. As the accepted answer to the other question says, <em>this is the expected behaviour</em>.</p>
  
  <p>But this is not always the <em>desired</em> behaviour. Should there be/is there a means in Maven to add to rather than override configuration?</p>
  
  <p>For example:
   - Provide ability to declare elements of the configuration final, so that children can add to them but not replace?
   - Allow child configuration to declare element as an addition, so it is merged with the parent</p>
  
  <hr>
  
  <p>A good example of when the override behaviour is not always desirable is for the aspectLibraries element of the aspectj-maven-plugin.</p>
  
  <p>In my parent POM I define a configuration for the aspectj plugin that declares a tracing jar to be used as an aspectLibrary.</p>
  
  <pre><code> &lt;plugin&gt;
     &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
     &lt;artifactId&gt;aspectj-maven-plugin&lt;/artifactId&gt;
     &lt;executions&gt;
       &lt;execution&gt;
       &lt;id&gt;compile_with_aspectj&lt;/id&gt;
         &lt;goals&gt;
           &lt;goal&gt;compile&lt;/goal&gt;
         &lt;/goals&gt;
       &lt;/execution&gt;
     &lt;/executions&gt;
     &lt;configuration&gt;
       &lt;aspectLibraries&gt;
         &lt;aspectLibrary&gt;
           &lt;groupId&gt;name.seller.rich&lt;/groupId&gt;
           &lt;artifactId&gt;tracing&lt;/artifactId&gt;
         &lt;/aspectLibrary&gt;
       &lt;/aspectLibraries&gt;
     &lt;/configuration&gt;
     &lt;dependencies&gt;
       &lt;dependency&gt;
         &lt;groupId&gt;aspectj&lt;/groupId&gt;
         &lt;artifactId&gt;aspectjtools&lt;/artifactId&gt;
         &lt;version&gt;1.5.3&lt;/version&gt;
       &lt;/dependency&gt;
     &lt;/dependencies&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>This is inherited by all the child projects and I get tracing in all the projects, which is nice. However if I define another aspectLibrary in a child POM, it replaces my tracing configuration.</p>
  
  <p>Note I have a workaround to this particular problem, I'm interested in the general case and implications for Maven.</p>
  
  <p>The simple answer would be to redeclare the configuration for the tracing jar in the child POM as well as the new jar, but this has maintenance implications, and if I want to declare the tracing configuration in a profile so it can be disabled if needed (which I do), I then need to reimplement the profile in the child.</p>
  
  <p>The dependency declaration in the above sample is merged with other dependency declarations in the parent and elsewhere. I know dependencies are a special case, but it shows that it is feasible to implement.</p>