在基于SpringBoot开发时经常使用<skipTests>true</skipTests>
跟<maven.test.skip>true</maven.test.skip>
跳过单元测试,如下:
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <spring-cloud.version>Finchley.SR1</spring-cloud.version> <!--surefire plugin方式跳过maven test, 等同$ mvn package -DskipTests--> <skipTests>true</skipTests> <!--maven方式跳过maven test, 等同$ mvn package -Dmaven.test.skip=true--> <maven.test.skip>true</maven.test.skip> </properties>
二者的根本区别在于<skipTests>true</skipTests>
会编译测试类,而<maven.test.skip>true</maven.test.skip>
不会编译测试类。
未经允许不得转载:鹞之神乐 » SpringBoot跳过单元测试:skipTests VS maven.test.skip