Maven Checkstyle Website

this question seems pretty common, but I really couldn't get it to work from existing answers. I have a simple maven project without any complicated configuration for deployment, etc. And you want to create a Maven CheckStyle report when you get to the "mvn site".

My pom.xml looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns: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 have mychecks.xml in the project root directory (next to pom.xml). The problem is that when I am on the "mvn site" nothing happens at all (except for maven, writing a few lines about BUILD SUCCESS). I read that I need to place mychecks.xml in a directory called "resources" or something like that, but that didn't work either.

Does anyone have a clue what to do so that the "mvn site" generates a checkstyle rport (and where to find it)? Any help was appreciated.

+4
source share
2 answers

Well, no wonder it didn't work! The maven plugin docs are really outdated (and rather scarce). I wonder why they don’t even put a marker on their site, that the information is out of date when changing important configuration parameters.

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

It is German, but just ignore it. XML speaks for itself.

+6
source

It looks like your problem is not related to the maven checkstyle plugin in the same way as fulfilling the site goal in maven 3 . There are versions of different site plugins for generating site information for maven 2 and maven 3 and the plugins page.

In fact, this wiki wiki page also talks about it.

+1
source

Source: https://habr.com/ru/post/1346346/


All Articles