mvn test 和mvn surefire:test 的区别
作者:互联网
mvn test 和 的区别 mvn surefire:test
以这两种方式运行它的区别在于:
mvn -Dtest=DatabaseTest test
mvn -Dtest=DatabaseTest surefire:test
我可以看到测试显示:
执行mvn test 执行的输出
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rac.mybatis ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rac.mybatis ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rac.mybatis ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/etomort/smip/oracle-rac/mybatis-rac/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rac.mybatis ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rac.mybatis ---
[INFO] Surefire report directory: /home/etomort/smip/oracle-rac/mybatis-rac/target/surefire-reports
surefire:test 的输出:
[INFO] --- maven-surefire-plugin:2.12.4:test (default-cli) @ rac.mybatis ---
[INFO] Surefire report directory: /home/etomort/smip/oracle-rac/mybatis-rac/target/surefire-reports
不同之处在于test
运行完整构建到执行测试的点,而surefire:test
仅执行测试,重新使用先前构建的中间结果。
所以,如果你是编辑测试并且只运行surefire:test
,新版本的测试将不会被编译,因此Maven将执行一些旧版本的测试。一般来说,很难说以这种方式执行哪个版本的测试,因此这就是人们通常使用mvn clean test
而不是mvn surefire:test
的原因。
Surefire是官方测试插件,必将进入测试阶段。
标签:INFO,rac,surefire,---,test,mvn 来源: https://blog.csdn.net/u011441473/article/details/120256819