groovy的最新升级带来了junit5,这使eclipse想要在junit5下运行所有测试。我可以通过运行配置并告诉Eclipse使用junit4来解决此问题,但这很繁琐。
是否可以告诉eclipse始终对特定项目(包括新测试)使用junit4?
答案 0 :(得分:0)
在启动配置中,您应该能够根据需要选择JUnit 3、4或5。
答案 1 :(得分:0)
您只能在 Eclipse 中指定配置文件并激活它。
示例(假设您的问题是由于对 groovy-all
的依赖而引起的):
<profiles>
<profile>
<id>eclipse-groovy-no-junit5</id>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${groovy.groupId}</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>${groovy.groupId}</groupId>
<artifactId>groovy-test-junit5</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>
然后去
<块引用>Project -> Properties -> Maven -> Active Maven Profiles
并指定配置文件名称eclipse-groovy-no-junit5
。
备注:groovy.groupId
设置为org.codehaus.groovy
(它是一个变量,因为在4.x中会被org.apache.groovy
替换),groovy.version
设置为{{ 1}}。
如果你想更详细一点,你可以添加...
3.0.8
...但无论如何它都是默认的。