我设法使用以下行从“src / main / java”中排除文件:
<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>
添加之后,maven生成了我的.classpath文件的以下行:
<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"/>
现在我如何为src / test / java做同样的事情?
我期待这样的东西出现在我的.classpath文件中:
<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"/>
看看第三行。我想要这个 - &gt; [exclude =“** / MyExcludedFileTest.java”]在我的.classpath文件中。我如何告诉maven这样做?
答案 0 :(得分:3)
使用<testExcludes>
。
这Q&A应该会有所帮助。
答案 1 :(得分:0)
对我来说,通过处理testExcludes但直接修改eclipse插件配置
无效<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<sourceExcludes>
<exclude>**/MyExcludedFile.java</exclude>
</sourceExcludes>
</configuration>
</plugin>