开发者

Maven Checkstyle Site

this question seems to be quite common, but I really couldn't make it work from the existing answers. I have a simple maven project without any complicated configuration for deploying etc. and want to generate a Maven CheckStyle report when hitting "mvn site".

My pom.xml is the following:

<project xmlns="http://maven.apache.org/POM/4.0.0" x开发者_开发技巧mlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>mygroup</groupId>
  <artifactId>TestProjekt</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>TestProjekt</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

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

</project>

I've got mychecks.xml in the root directory of the project (next to the pom.xml). The problem is, when I hit "mvn site", nothing happens at all (apart from maven writing a few lines about BUILD SUCCESS). I read that I have to place the mychecks.xml in a directory named "resources" or something like that, but that didn't work either.

Does someone have a hint what to do to make "mvn site" generate a checkstyle rport (and where to find it)? Any kind of help appreciated.


Well no wonder it didn't work! The docs on the maven site about the plugin are really outdated (and quite meager too). I'm wondering why they don't even put a marker on their site that the info is outdated when changing important config options.

You can find the real config for Maven 3 and CheckStyle at http://www.torsten-horn.de/techdocs/maven.htm#Site-Project-Reports-Mvn3

It's german, but just ignore it. The XML speaks for itself.


It looks like your issue is not with maven checkstyle plugin as much as running the site goal in maven 3. There are different site plugin versions to generate site information for maven 2 and maven 3 and the plugin page documents this.

In fact, this maven wiki page talks about it too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜