首页 > 解决方案 > 执行 Maven 构建时 Maven 跳过生成报告

问题描述

我在项目中定义了几个报告插件,当我执行 Maven → 构建失败时,FileNotFoundException当我执行 Maven → 清理时报告被清除。有没有办法在进行 Maven 构建时忽略报告,以便构建通过而没有任何问题?我尝试使用 Surefire 插件,但没有运气。

我的pom.xml样子是这样的:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <version>3.1</version>
  <configuration>
    <skip>${maven-site-plugin.skip}</skip>
    <skipDeploy>true</skipDeploy>
  </configuration>
</plugin>

<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-report-plugin</artifactId>
      <version>2.19.1</version>
    </plugin>
  </plugins>
</reporting>

<dependency>
  <groupId>com.aventstack</groupId>
  <artifactId>extentreports</artifactId>
  <version>3.0.5</version>
</dependency>
<dependency>
  <groupId>net.masterthought</groupId>
  <artifactId>cucumber-reporting</artifactId>
  <version>3.2.0</version>
</dependency>

标签: mavenselenium-webdrivercucumber-javamaven-site-plugin

解决方案


对于 maven-surefire 在版本之后添加

<configuration>
    <skipTests>true</skipTests>
</configuration>

推荐阅读