【发布时间】:2010-06-12 12:08:03
【问题描述】:
我有以下问题。 我想在测试编译阶段排除一些 .java 文件(**/jsfunit/*.java),另一方面我想在编译阶段包含它们(id 我用 tomcat:run 目标启动 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>
但它不起作用:default-testCompile 执行中的 exclude 不会过滤这些类。 如果我删除 cmets,那么所有匹配 **/jsfunit/*.java 的类都会被编译,但前提是我触摸它们!
【问题讨论】:
-
jsfunit 文件的具体路径是什么(相对于
${basedir})? -
src/main/java/de/hska/repo/ui/jsfunit
-
我不明白。
compiler:testCompile编译应用程序测试源(即src/test/main下的测试源),所以没有什么可以排除的。究竟是什么问题?你想解决什么问题? -
嗯..你是对的。我的问题是:jsfunit 使用 junit3,但我们的 junit 测试使用 junit4。在 pom.xml 中我不能包含 junit3 和 junit4 依赖项,如果我尝试运行 junit 测试,编译器无法从 jsfunit/package 编译文件,因为类路径中只有 junit4(但不是 junit3)
-
但如果我运行 tomcat:run 目标,我需要 jsfunit 包中的类
标签: compilation maven-2