测试插件,surefire-plugin

主页


完整参数
maven默认配置已经加载过该插件
相当于默认在pom文件有
<project>
  [...]
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.18</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  [...]
</project>



对于maven 的test生命周期,默认完成了对该插件的调用
mvn test


该插件支持的目标包括
surefire:help
surefire:test

忽略failure的测试
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>


或者在运行的时候
mvn test -Dmaven.test.failure.ignore=true


对于mvn install生命周期而言,默认配置下,是依赖于test生命周期
而想跳过test,可以通过配置或者运行时参数
mvn install -Dmaven.test.skip=true
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>

猜你喜欢

转载自liyixing1.iteye.com/blog/2170516