title: Maven-ear-plugin - excluding multiple modules i.e. jars, wars etc
body: <p>I've been using the Maven EAR plugin for creating my ear files for a new project. I noticed in the plugin documentation you can specify exclude statements for modules. For example the configuration for my plugin is as follows...</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;plugins&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-ear-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.4.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;jboss&gt;
                  &lt;version&gt;5&lt;/version&gt;
              &lt;/jboss&gt;
              &lt;modules&gt;
                  &lt;!-- Include the templatecontroller.jar inside the ear --&gt;
                      &lt;jarModule&gt;
                          &lt;groupId&gt;com.kewill.kdm&lt;/groupId&gt;
                          &lt;artifactId&gt;templatecontroller&lt;/artifactId&gt;
                          &lt;bundleFileName&gt;templatecontroller.jar&lt;/bundleFileName&gt;
                          &lt;includeInApplicationXml&gt;true&lt;/includeInApplicationXml&gt;
                      &lt;/jarModule&gt;
                      &lt;!-- Exclude the following classes from the ear --&gt;
                      &lt;jarModule&gt;
                         &lt;groupId&gt;javax.activation&lt;/groupId&gt;
                         &lt;artifactId&gt;activation&lt;/artifactId&gt;
                         &lt;excluded&gt;true&lt;/excluded&gt;
                      &lt;/jarModule&gt;
                      &lt;jarModule&gt;
                     &lt;groupId&gt;antlr&lt;/groupId&gt;
                     &lt;artifactId&gt;antlr&lt;/artifactId&gt;
                     &lt;excluded&gt;true&lt;/excluded&gt;
                  &lt;/jarModule&gt;
                  ... declare multiple excludes
                  &lt;security&gt;
                      &lt;security-role id="SecurityRole_1234"&gt;
                          &lt;role-name&gt;admin&lt;/role-name&gt;
                      &lt;/security-role&gt;
                  &lt;/security&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  </code></pre>
  
  <p>This approach is absolutely fine with small projects where you have say 4-5 modules to exclude. However, in my project I have 30+ and we've only just started the project so as it expands this is likely to grow. </p>
  
  <p>Besides explicitly declaring exclude statements per module is it possible to use wildcards or and exclude all maven dependencies flag to only include those modules i declare and exclude everything else? Is anyone aware of a more elegant solution?</p>