【问题标题】:Exclude not needed reports in checkstyle reports在检查式报告中排除不需要的报告
【发布时间】:2013-11-07 05:12:08
【问题描述】:

我是第一次使用 maven checkstyle 插件。我在父 pom 中添加了 checkstyle 插件,并在 checkstyle.xml 中指定了一些规则列表。

我运行“mvn clean site”来生成报告。每件事都运行良好,但它也会生成许多不需要的报告。我该如何预防。

我尝试了“mvn clean checkstyle:checkstyle”,但它没有考虑我的 checkstyle.xml 规则。 IE。它还会生成所有违反默认规则的报告。

而且网页也显示不正确。 IE。它生成没有样式的 .html 文件(.css 文件),所以看起来很糟糕。

在我的 pom.xml 中是

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.10</version>
            </plugin>
        </plugins>

    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

【问题讨论】:

    标签: maven-plugin static-analysis checkstyle maven-site-plugin


    【解决方案1】:

    Run Selective Reports

    要选择性地运行报告,您可以将其配置为仅包含您喜欢的报告。使用“mvn site:site”生成选定的报告。

    <project>
      ...
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.7</version>
            <reportSets>
              <reportSet>
                <reports>
                  <report>dependencies</report>
                  <report>project-team</report>
                  <report>mailing-list</report>
                  <report>cim</report>
                  <report>issue-tracking</report>
                  <report>license</report>
                  <report>scm</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
          ...
        </plugins>
      </reporting>
      ...
    </project>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-30
      • 2021-02-01
      相关资源
      最近更新 更多