在检查样式报告中排除不需要的报告



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

我运行"mvn清洁站点"来生成报告。一切都工作正常,但它也会生成很多不需要的报告。我该如何预防。

我尝试了"mvn clean checkstyle:checkstyle",但它没有考虑我的 checkstyle.xml 规则。 它也生成所有默认规则违规的报告。

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

在我的诗歌中.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>

运行选择性报告

若要有选择地运行报告,可以将其配置为仅包含您喜欢的报告。使用"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>

最新更新