title: Exclude *.java source files from WAR package
body: <p>I have a problem with filtering my *.java files from resulting WAR package.
  I'm using maven 3.0.3. My pom.xml is like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/maven-v4_0_0.xsd"&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;com.my&lt;/groupId&gt;
      &lt;artifactId&gt;app&lt;/artifactId&gt;
      &lt;version&gt;1.00&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.my.app&lt;/groupId&gt;
  &lt;artifactId&gt;app&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;name&gt;My Webapp&lt;/name&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;My&lt;/finalName&gt;
  
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/java&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;excludes&gt;
                  &lt;exclude&gt;*.java&lt;/exclude&gt;
              &lt;/excludes&gt;
          &lt;/resource&gt;
  
          &lt;resource&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  ....
  </code></pre>
  
  <p>and then I'm asembling my WAR with <code>mvn clean package</code>. 
  After that I can see all my *.java files inside my WAR. Am I having wrong config or\and am I executing wrong maven plugins?</p>
  
  <p>P.S. I've also tried to use the following plugin:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
        &lt;warSourceExcludes&gt;**/*.java&lt;/warSourceExcludes&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
  </code></pre>
  
  <p>with <code>mvn war:war</code> but with no success.</p>