Sorry if I will not be precise enough but I spent some time until I managed to configure custom checkstyle to be included within report generated by maven2. I want to share this knowledge so maybe somebody will need not spend so much time on this because I followed description on checkstyle maven2 plugin but that didn't work.
I have found solutions from the following mailing list archive. Follows short description.
Problem is following. I have maven java project and custom checkstyle configuration. I want to include checkstyle report into maven2 generated report. Solution is:
Create new maven project and into resources folder include your custom checkstyle configuration file e.g. my_checkstyle.xml.
Deploy this project to local or your intranet maven repository.
For this example groupId is com.my.checkstyle and artifactId is checkstyle and version is 1.0-SNAPSHOT
Then within pom of project for which you want to have custom checkstyle validation add following lines:
<build>
<extensions>
<extension>
<groupid>com.my.checkstyle</groupid>
<artifactid>checkstyle</artifactid>
<version>1.0-SNAPSHOT</version>
</extension>
</extensions>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configlocation>my_checkstyle.xml</configlocation>
</configuration>
</plugin>
</plugins>
</reporting>
Run mvn site for your project and your customized checkstyle report will be included within your project.
Note: For some reasons, not all customizations work. Plugin is reporting errors when module element contains subelements like suppressLoadErrors. Currently I don't have enough time to play with this problem. I think solution is with using suppress warnings. If I return to this problem and find solution I will post it here.
Link to maven2 checkstyle plugin is here.
Showing posts with label maven2. Show all posts
Showing posts with label maven2. Show all posts
Sunday, October 28, 2007
Subscribe to:
Posts (Atom)