Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project Terminal执行命令 mvn install -Dmaven.test.skip=true 方法3:Spring boot项目使用 spring-boot-maven-plugin插件已经集成了maven-surefire-plugin
maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test [INFO ------------------------------------------- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies
org.codehaus.plexus:plexus-utils:jar:1.5.9 org.apache.maven.surefire:surefire-booter:jar:2.5 org.apache.maven.plugins:maven-surefire-plugin :jar:2.5 搜索方式 g:"org.apache.maven.plugins" AND a:"maven-surefire-plugin" AND v:"2.5" groupIP artifact -------------- [INFO] Internal error in the plugin manager executing goal 'org.apache.maven.plugins:maven-surefire-plugin :2.5:test': Unable to load the mojo 'org.apache.maven.plugins:maven-surefire-plugin:2.5:test' in the plugin 'org.apache.maven.plugins:maven-surefire-plugin'.
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test 在运行mvn install或mvn plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin Terminal执行命令 mvn install -Dmaven.test.skip=true 方法四:Spring boot项目使用 spring-boot-maven-plugin插件已经集成了maven-surefire-plugin
-Dmaven.test.skip=true: 不执行测试用例,也不编译测试用例类 当然,还可以使用maven-surefire-plugin插件配置参数控制跳过单元测试。 <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin configuration> </plugin> </plugins> </build> </project> 详见:http://maven.apache.org/surefire/maven-surefire-plugin
maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test [INFO ------------------------------------------- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies :2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies
如果你执行过mvn test或者执行其他maven命令时跑了测试用例,你就已经用过maven-surefire-plugin了。 maven-surefire-plugin是maven里执行测试用例的插件,不显示配置就会用默认配置。这个插件的surefire:test命令会默认绑定maven执行的test阶段。 的默认配置,我们还有必要了解maven-surefire-plugin的配置么? 虽说maven-surefire-plugin有默认配置,但是当需要修改一些测试执行的策略时,就有必要我们去重新配置这个插件了。 这个插件常用的都介绍了.但是maven-surefire-plugin没介绍的远比这些多,看看它的配置项就知道了.
如果你执行过mvn test 或者执行其他maven命令时跑了测试用例,你就已经用过maven-surefire-plugin 了。 maven-surefire-plugin 是maven里执行测试用例的插件,不显示配置就会用默认配置。这个插件的surefire:test 命令会默认绑定maven执行的test 阶段。 plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin
这插件是 maven-surefire-plugin—测试运行器。 默认情况下, maven-surefire-plugin 的 test 目标会自动执行测试源码路径(默认 src/test/java/)下所有符合一组命名模式的测试类如: **/Test*.java 插件提供该属性(一般不推荐): <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 即使没有任何测试也不要报错,否侧maven-surefire-plugin找不到任何匹配的测试类,就会报错并导致构建失败; PS:上述命令行动态指定测试类的方法都应该只是临时使用,否则失去测试本身意义 maven 自动运行测试: <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId
Sonatype Nexus:https://repository.sonatype.org/ MVNrepository:http://mvnrepository.com/ maven test maven-surefire-plugin 这插件是 maven-surefire-plugin—测试运行器 默认情况下,maven-surefire-plugin 的 test 目标会自动执行测试源码路径(默认 src/test/java/)下所有符合一组命名模式的测试类如 插件提供该属性(一般不推荐): <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin </version> <configuration> <skipTests>true</skipTests> </configuration> </plugin> 动态执行运行的测试用例 maven-surefire-plugin 即使没有任何测试也不要报错,否侧maven-surefire-plugin找不到任何匹配的测试类,就会报错并导致构建失败。
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 8560d50788904ead0fbd9b7e0c1183&newp=81769a47889c1eed11bd9b7e0c1198231610db2151d3d51e218bcc0ada&user=baidu&fm=sc&query=maven-surefire-plugin
maven中运行测试用例使用到的插件坐标是: <dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 先看一下不加参数的效果: D:\code\IdeaProjects\maven-chat06>mvn org.apache.maven.plugins:maven-surefire-plugin:test :test 效果如下: D:\code\IdeaProjects\maven-chat06>mvn org.apache.maven.plugins:maven-surefire-plugin:test Group Id: org.apache.maven.plugins Artifact Id: maven-surefire-plugin Version: 2.12.4 Goal Prefix: surefire [INFO] [INFO] --- maven-surefire-plugin:2.12.4:help (default) @ maven-chat06 --- [INFO] Maven Surefire
文件的插件标记中将 skipTests 属性指定为 true: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin defaultValueOfSkip 的值设置为 false: 命令: mvn package -DdefaultValueOfSkip=false END 4.参考 http://maven.apache.org/surefire/maven-surefire-plugin
configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 使用上面的,不要用这个 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin
testng-result.xml文件中关于中文的都是乱码 解决方法 eclipse已设置了utf-8去编译,所以直接运行run as testng ,在console栏输出中文是没有问题的 通过mvn去执行的时候用的是maven-surefire-plugin > <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin
artifactId>allure-testng</artifactId> <version>2.6.0</version> <scope>test</scope> </dependency> 加入 maven-surefire-plugin -- maven-surefire-plugin 配合testng/junit执行测试用例的maven插件 --> <groupId>org.apache.maven.plugins </groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version
jacoco.version}</version> <scope>test</scope> </dependency> 接着,我们需要配置 jacoco-maven-plugin 和 maven-surefire-plugin 内容: <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId jacoco 使用的是 maven-surefire-plugin 插件,它的默认测试类名规范是: Test*.java:以 Test 开头的 Java 类; *Test.java:以 Test 结尾的 TestCase 结尾的 Java 类; 或者可以在pom中自定义测试类: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin
hello world"; 14 } 15 16 } 运行发现出现错误: 出现错误: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin :test (default-test) on project fte-common: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin :2.22.2:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.2 or one of its dependencies 44 <plugin> 45 <groupId>org.apache.maven.plugins</groupId> 46 <artifactId>maven-surefire-plugin
maven插件配置:(surefire2.14以下版本) <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 插件配置:(surefire2.14及其以上版本) <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin WEB-INF文件夹放在Class Path中,配置如下: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin
这个时候就需要 Maven 登场了,利用 Maven 的Maven-Surefire-Plugin插件可以帮助我们完成上述的目标!它可以通过命令行的形式来管理我们要执行的用例。 junit-vintage-engine</artifactId> <version>5.6.2</version> <scope>test</scope> </dependency> Maven-Surefire-Plugin plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin surefire 插件下添加 configuration: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin 七、写在最后 这里介绍了 maven-surefire-plugin 插件在测试执行中的一些常见用法,还有很多其他的用法,例如: 使用很复杂的格式匹配 控制在不同级别上的多线程和多进程执行 后续将慢慢研究补充