maven checkstyle plugin is telling me that it's using sun_checks.xml
by default:
INFO] There are 5 errors reported by Checkstyle 8.29 with sun_checks.xml ruleset.
I mean, I've not located any sun_checks.xml
into my project in order to tell checkstyle plugin to use this file.
So, I guess, plugin has available this file by default.
According to documentation, plugin has available two check rulesets by default: sun_checks.xml
and google_checks.xml
.
I've tried to change it:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle-plugin.version}</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
After performing mvn checkstyle:check
goal, it's telling me that it's using sun_checks.xml
instead of google_checks.xml
:
$ mvn checkstyle:check
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< net.gencat.clt.arxius:backend >--------------------
[INFO] Building backend 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.1:check (default-cli) @ backend ---
[INFO] There are 4 errors reported by Checkstyle 8.29 with sun_checks.xml ruleset.
[ERROR] src/main/java/net/gencat/clt/arxius/backend/BackendApplication.java:[1] (javadoc) JavadocPackage: Missing package-info.java file.
[ERROR] src/main/java/net/gencat/clt/arxius/backend/BackendApplication.java:[6,1] (design) HideUtilityClassConstructor: Utility classes should not have a public or default constructor.
[ERROR] src/main/java/net/gencat/clt/arxius/backend/BackendApplication.java:[9,1] (whitespace) FileTabCharacter: File contains tab characters (this is the first instance).
[ERROR] src/main/java/net/gencat/clt/arxius/backend/BackendApplication.java:[9,9] (javadoc) MissingJavadocMethod: Missing a Javadoc comment.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.265 s
[INFO] Finished at: 2020-10-21T10:45:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:check (default-cli) on project backend: You have 4 Checkstyle violations. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Any ideas?
You are using the google_checks.xml under
<reporting>
tag. You can keep it like this but repoting tag as maven.apache.org says: A plugin is actually not a report plugin in itself. But one (or several) of its goals or Mojos may be specialized to be invoked by maven-site-plugin, typically during the site build life cycle.if you want to use mvn checkstyle:check goal you need to also have: