maven-compiler-plugin exclude [英] maven-compiler-plugin exclude
问题描述
我有以下问题。
我想在测试编译阶段排除一些.java文件(** / jsfunit / *。java),另一方面,我想在编译阶段包含它们(id i start tomcat with tomcat:run goal)
I have a following problem. I would like to exclude some .java files (**/jsfunit/*.java) during the test-compile phase and on the other side I would like to include them during the compile phase (id i start tomcat with tomcat:run goal)
我的pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<!-- <excludes>
<exclude>**/*JSFIntegration*.java</exclude>
</excludes> -->
</configuration>
<executions>
<!-- <execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/jsfunit/*.java</include>
</includes>
</configuration>
</execution>-->
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<excludes>
<exclude>**/jsfunit/*.java</exclude>
</excludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
但它不工作:exclude in default-testCompile执行不过滤这些类。
如果我删除了注释,那么所有匹配的类** / jsfunit / *。java将被编译,但是只有当我碰它们!
But it does not work : exclude in default-testCompile execution does not filter these classes. If I remove the comments then all classes matched **/jsfunit/*.java would be compiled but only if I touch them!
推荐答案
要从default-testCompile阶段排除文件,必须使用< testExcludes>
。所以上面的例子看起来像这样:
To exclude files from the default-testCompile phase, you have to use <testExcludes>
. So your example above would look like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testExcludes>
<exclude>**/jsfunit/*.java</exclude>
</testExcludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
这篇关于maven-compiler-plugin exclude的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!