Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing checkstyle from running in a specific maven submodule

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?

like image 772
Miquel Avatar asked Nov 17 '12 11:11

Miquel


People also ask

How do I disable Checkstyle Pom?

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.

What is Maven Checkstyle plugin?

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.


2 Answers

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 
like image 184
Haim Raman Avatar answered Sep 20 '22 12:09

Haim Raman


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 ;-)

like image 26
Stephen Connolly Avatar answered Sep 19 '22 12:09

Stephen Connolly