Compilation maven编译器插件排除
我有以下问题。 我想在测试编译阶段排除一些.java文件(**/jsfunit/*.java),另一方面,我想在编译阶段包括它们(id我用tomcat:run-goal启动tomcat) 我的pom.xmlCompilation maven编译器插件排除,compilation,maven-2,Compilation,Maven 2,我有以下问题。 我想在测试编译阶段排除一些.java文件(**/jsfunit/*.java),另一方面,我想在编译阶段包括它们(id我用tomcat:run-goal启动tomcat) 我的pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifac
<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>
org.apache.maven.plugins
maven编译器插件
1.6
1.6
默认测试编译
测试编译
**/jsfunt/*.java
测试编译
但它不起作用:默认的testCompile执行中的exclude不会过滤这些类。
如果我删除注释,那么所有匹配**/jsfunit/*.java的类都将被编译,但只有在我触摸它们的情况下 要从默认测试编译阶段排除文件,必须使用
。因此,您上面的示例如下所示:
<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>
org.apache.maven.plugins
maven编译器插件
1.6
1.6
默认测试编译
测试编译
**/jsfunt/*.java
测试编译
jsfunit文件的确切路径是什么(相对于${basedir}
)?src/main/java/de/hska/repo/ui/jsfunitI不理解compiler:testCompile
编译应用程序测试源(即src/test/main
下的测试源),因此无需排除任何内容。到底是什么问题?你想解决什么问题?嗯。。你是对的。我的问题是:JSUnit使用junit3,但我们的junit测试使用junit4。在pom.xml中,我不能包含junit3和junit4依赖项,如果我尝试运行junit测试,编译器将无法从jsfunit/package编译文件,因为类路径中只有junit4(但不是junit3),但如果我运行tomcat:run-goal,我需要jsfunit包中的类