Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying CheckStyle Errors via Maven CLI

Tags:

checkstyle

I build my projects via mvn on the command line.

Whenever a checkStyle error occurs, I see this type of output:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-
plugin:2.4:checkstyle (default) on project myProject-server: 
An error has occurred in Checkstyle report generation. 
There are 2 checkstyle errors. -> [Help 1]

How do I find out which code lines are causing these CheckStyle failures?

like image 874
Kevin Meredith Avatar asked Sep 04 '12 16:09

Kevin Meredith


People also ask

How do I check my Checkstyle violations?

To view to violation report, go to Window -> Show View -> Other, and search for Checkstyle. Options for Violations and Violations Chart should be displayed.

How do you fix a Checkstyle problem?

No Checkstyle Plugin If your build does not use either of the Gradle or Maven Checkstyle plugins, you can still configure the rewrite build plugins to use a checkstyle xml configuration file. At this point, you're ready to fix Checkstyle policy violations by running mvn rewrite:run or gradlew rewriteRun .


1 Answers

CheckStyle saves reports to target/checkstyle-result.xml (for non-modular project). So you may find out this file and examine it.

Another case is to configure maven-checkstyle-plugin to show all such warnings/error to console:

<consoleOutput>true</consoleOutput>
like image 56
Slava Semushin Avatar answered Oct 20 '22 19:10

Slava Semushin