title: Maven multi-module project duplicates ear output, one without resource filtering
body: <p>Suppose I have a Maven multi-module Java EE 6 app:</p>
  
  <pre><code>foobar/
      foobar-ear/
          src/
              main/
                  application/
                      META-INF/
                          MANIFEST.MF
                          glassfish-application.xml
                          glassfish-resources.xml
                  filters/
                      dev.properties
                      prod.properties
                      test.properties
          pom.xml
      foobar-web/
      foobar-ejb/
      pom.xml
  </code></pre>
  
  <p>As you can see, I'm using resource filtering. The pom in foobar-ear defines the build profiles:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;dev&lt;/id&gt;
          &lt;properties&gt;
              &lt;env&gt;dev&lt;/env&gt;
          &lt;/properties&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;test&lt;/id&gt;
          &lt;properties&gt;
              &lt;env&gt;test&lt;/env&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;demo&lt;/id&gt;
          &lt;properties&gt;
              &lt;env&gt;demo&lt;/env&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;prod&lt;/id&gt;
          &lt;properties&gt;
              &lt;env&gt;prod&lt;/env&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>And each child project's pom defines resource filtering. In foobar-ear/pom.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;build&gt;
      ...
  
      &lt;filters&gt;
          &lt;filter&gt;src/main/filters/${env}.properties&lt;/filter&gt;
      &lt;/filters&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/application&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;includes&gt;
                  &lt;include&gt;**/*.xml&lt;/include&gt;
              &lt;/includes&gt;
          &lt;/resource&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/application&lt;/directory&gt;
              &lt;filtering&gt;false&lt;/filtering&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;**/*.xml&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  
      ...
  &lt;/build&gt;
  </code></pre>
  
  <p>The intention here is to filter foobar-ear/src/main/application/META-INF/glassfish-resources.xml which contains placeholders for JDBC and JavaMail configuration items which are defined in the filter properties files.</p>
  
  <p>When I build using <code>mvn -Pdev clean install</code>, I get this output in foobar-ear:</p>
  
  <pre><code>foobar-ear/
      target/
          classes/
              META-INF/
                  MANIFEST.MF
                  glassfish-application.xml
                  glassfish-resources.xml    &lt;- This one is filtered
          foobar-ear/
              META-INF/
                  MANIFEST.MF
                  glassfish-application.xml
                  glassfish-resources.xml    &lt;- This one is NOT filtered
              lib/
              foobar-ejb.jar
              foobar-web.war
          application.xml
          foobar-ear.ear                     &lt;- ear file. Contents same as foobar-ear/
  </code></pre>
  
  <p>As you can see, the resources copied to the usual output location are filtered, but those in the EAR directory layout and ear file are not.</p>