正如Cedric所说,Surefire在同一项目中的TestNG和JUnit测试存在一些问题。我发现运行“ mvn test -X
”时,即使实际测试是一个JUnit,Surefire仍使用testng插件而不是junit。
[DEBUG] Adding to surefire test classpath: C:UsersCroydon.IVSTEL1.m2repositoryorgapachemavensurefiresurefire-testng2.8surefire-testng-2.8.jar Scope:test
我检查了依赖关系层次结构,没有找到其他需要testng的插件。然后我发现了春天的Testng依赖。
<dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-testng-plugin</artifactId> <version>${org.apache.struts.version}</version> <scope>test</scope></dependency>禁用后,
[DEBUG] Adding to surefire test classpath: C:UsersCroydon.IVSTEL1.m2repositoryorgapachemavensurefiresurefire-junit42.8surefire-junit4-2.8.jar Scope: test
Surefire使用junit插件,并且检测到测试。



