如果您想要Surefire Maven插件不执行其中一个测试,您可以使用Maven的excludes
参数来排除特定的测试类。
在pom.xml文件中,您可以在Surefire插件配置中添加excludes
参数,如下所示:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<excludes>
<exclude>com.example.TestClassToExclude</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
在上面的示例中,com.example.TestClassToExclude
是您希望Surefire插件跳过执行的测试类。
确保将groupId
、artifactId
和version
与您的项目中实际使用的Surefire插件版本相匹配。
保存pom.xml并重新运行Maven测试命令,Surefire插件将不会执行被排除的测试类。