我有一个问题。我想在测试编译阶段排除一些.java文件(**/jsfunit/*.java),另一方面我想在编译阶段包括它们(id我用tomcat:run tomcat启动tomcat)
我的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>但它不起作用:默认情况下排除-testCompile执行不会过滤这些类。如果我删除注释,那么所有匹配**/jsfunit/*.java的类都将被编译,但只有当我接触它们时才会被编译!
发布于 2010-09-07 14:26:43
要从default-testCompile阶段排除文件,必须使用<testExcludes>。因此,上面的示例将如下所示:
<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>https://stackoverflow.com/questions/3028612
复制相似问题