I would like to define a checkstyle run in a pom file, and have it run on all the submodules except certain specified ones.
In other words, I need some sort of <excludes>
(which exists but applies to filenames) but which targets modules. Any idea anyone?
If you want to disable checkstyle from your pom, you can add the checkstyle plugin to the pom and set the skip flag to prevent the check.
The Checkstyle Plugin generates a report regarding the code style used by the developers. For more information about Checkstyle, see https://checkstyle.org/. This version of the plugin uses Checkstyle 9.3 by default and requires Java 8. But you can upgrade the version used at runtime.
If you do not want to change your pom.xml you may set the skip to true from command line using the –D option. This was mentioned above as "overridden the skip parameter within an execution". This is quite similar to -Dmaven.test.skip=true usage.
mvn site -Dcheckstyle.skip=true
Put the following in the projects that you want checkstyle disabled for:
<project> ... <properties> ... <checkstyle.skip>true</checkstyle.skip> ... </properties> ... </project>
Checkstyle will still run, but will perform a no-op...
That is unless you override the default binding of maven-checkstyle-plugin's skip
parameter in which case you could achieve the same effect with the following in the specific project
<project> ... <build> ... <plugins> ... <plugin> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> ... </plugins> ... </build> ... </project>
Unless of course you have overridden the skip
parameter within an execution... but if you know what that is you also know the solution and would not be asking this question ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With