简体   繁体   English

为什么需要定义maven-surefire-plugin才能运行测试

[英]Why maven-surefire-plugin needs to be defined for the tests to be run

If I call mvn install for example, the test phase being located before in the hierarchy should be executed. 例如,如果我调用mvn install ,则应该执行位于层次结构中之前的测试阶段。 However it seems not to be the case. 但是,似乎并非如此。

I actually need to specify it manually: mvn test install in order for my tests to be executed. 我实际上需要手动指定它: mvn test install以便执行我的测试。

OR 要么

Respecifying the surefire plugin in the pom.xml: 在pom.xml中重新指定surefire插件:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
</plugin>

The test phase is supposed to call the maven-surefire-plugin which is a core plugin. 测试阶段应该调用maven-surefire-plugin,它是一个核心插件。 This behavior doesn't seem consistent to me. 这种行为对我而言似乎并不一致。 Am I missing something ? 我想念什么吗?

EDIT: I am using Maven 3.2.1 编辑:我正在使用Maven 3.2.1

The Maven version I am using (3.2.1) embeds the version 2.12.4 of the maven-surefire-plugin. 我正在使用的Maven版本(3.2.1)嵌入了2.12.4版本的maven-surefire-plugin。 My project was a study case and had no test classes in it. 我的项目是一个研究案例,其中没有测试类。

The 2.4.2 version of maven-surefire-plugin must fetch by default the Test reports even if no test class is encountered. 默认情况下,即使未遇到任何测试类,2.4.2版本的maven-surefire-plugin也必须获取“测试”报告。 The 2.12.4 seems not to behave this way. 2.12.4似乎没有这种行为。

When I was specifying the maven-surefire-plugin, I was overriding the plugin definition to the version to 2.4.2. 当我指定maven-surefire-plugin时,我将插件定义覆盖到版本2.4.2。

My apologies for having taken your attention for such an edge case and also with a lack of details. 我很抱歉在这种情况下引起您的注意,同时又缺乏细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 maven-surefire-plugin不会运行并行测试 - maven-surefire-plugin doesn't run parallel tests 为什么maven-surefire-plugin跳过带有日志消息“因为已经为此配置运行了”的测试? - Why maven-surefire-plugin skip tests with log message “because it has already been run for this configuration”? 为什么maven-surefire-plugin会在我的集成测试中运行 - Why maven-surefire-plugin would run on my integration test 为什么我的maven-surefire-plugin需要坐在主项目构建中? - Why my maven-surefire-plugin needs to sit in the main project build? Maven-surefire-plugin测试在Jenkins构建中失败,但在本地成功运行? - Maven-surefire-plugin tests fail in Jenkins build but run successfully locally? 带有Maven-surefire-plugin的UnsatisfiedLinkError - UnsatisfiedLinkError with maven-surefire-plugin Spring Boot 无法运行 maven-surefire-plugin ClassNotFoundException org.apache.maven.surefire.booter.ForkedBooter - Spring Boot fails to run maven-surefire-plugin ClassNotFoundException org.apache.maven.surefire.booter.ForkedBooter maven-surefire-plugin包含/排除优先级 - maven-surefire-plugin include/exclude precedence 使用maven-surefire-plugin测试计数错误 - wrong test count with maven-surefire-plugin 日食中缺少maven-surefire-plugin - maven-surefire-plugin missing in eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM