[英]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.