2

I managed to exclude files from "src/main/java" using the following lines:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
            <excludes>
            <exclude>**/MyExcludedFile.java</exclude>
        </excludes>
    </configuration>
</plugin>

After adding that, maven generated the following lines of my .classpath file:

<classpathentry excluding="**/MyExcludedFile.java" kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>

Now how do I do the same thing for src/test/java?

I'm expecting something like this to be on my .classpath file:

<classpathentry excluding="**/MyExcludedFile.java" kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry excluding="**/MyExcludedFileTest.java" kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>

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?

supertonsky
  • 2,563
  • 6
  • 38
  • 68

2 Answers2

3

Use <testExcludes>.

This Q&A should help.

Community
  • 1
  • 1
Maniganda Prakash
  • 4,702
  • 8
  • 34
  • 42
0

For me it didn't work by handling testExcludes but by directly modifying the eclipse plugin configuration

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <configuration>
        <sourceExcludes>
            <exclude>**/MyExcludedFile.java</exclude>
        </sourceExcludes>
    </configuration>
</plugin>
raisercostin
  • 8,777
  • 5
  • 67
  • 76