title: How do I exclude sources from my test folder from my classpath using Maven?
body: <p>I managed to exclude files from "src/main/java" using the following lines:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;source&gt;1.5&lt;/source&gt;
          &lt;target&gt;1.5&lt;/target&gt;
              &lt;excludes&gt;
              &lt;exclude&gt;**/MyExcludedFile.java&lt;/exclude&gt;
          &lt;/excludes&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>After adding that, maven generated the following lines of my .classpath file:</p>
  
  <pre><code>&lt;classpathentry excluding="**/MyExcludedFile.java" kind="src" output="target/classes" path="src/main/java"/&gt;
  &lt;classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/&gt;
  &lt;classpathentry kind="src" output="target/test-classes" path="src/test/java"/&gt;
  &lt;classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/&gt;
  </code></pre>
  
  <p><strong>Now how do I do the same thing for src/test/java?</strong></p>
  
  <p>I'm expecting something like this to be on my .classpath file:</p>
  
  <pre><code>&lt;classpathentry excluding="**/MyExcludedFile.java" kind="src" output="target/classes" path="src/main/java"/&gt;
  &lt;classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/&gt;
  &lt;classpathentry excluding="**/MyExcludedFileTest.java" kind="src" output="target/test-classes" path="src/test/java"/&gt;
  &lt;classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/&gt;
  </code></pre>
  
  <p>Take a look on the third line. I want this -> [excluding="**/MyExcludedFileTest.java"] to be on my .classpath file. How do I tell maven to do that?</p>