Maven Checkstyle Exclude File

Active2 years, 1 month ago

I am using Maven
I have a parent module and some other modules. They look like:

Maven pom file for artifact version org.apache.maven.plugins:maven-checkstyle-plugin:2.12.1 / Apache Maven Checkstyle Plugin / Generates a report on violations of code style and optionally fails the build if violations are detected. / Get informed about new snapshots or releases. I have in the project Super_CheckStyle definitions of the checkstyle and suppressions. In the project Specific_Checkstyle is customized suppressions.xml file. Because of the maven lifecycle Super_CheckStyle project is used during child installation (mvn install). Import Checkstyle Project. Generate sources that a required by checkstyle by right click over pom.xml file and click on menu 'Maven / Generate Sources and Update Folders' Debug. Open the Check's source file by double click on it in a source tree as is shown. Our shared inspection scope should be used to exclude such files. Using a Suppressions Filter. Checkstyle allows the definition of a list of files and their line ranges that should be suppressed from reporting any violations (known as a suppressions filter ). Example: pom.xml - Specifies the suppressions filter that Checkstyle should use.. Here you can find example how to use sevntu-checkstyle-maven-plugin plugin in Maven and Ant projects - sevntu-checkstyle/checkstyle-samples. I found Excluding classes in Maven Checkstyle plugin reports which explains well how to exclude. I don't seem to get how to exclude a file like LICENSE.txt in the.

I tried to replace the rules with my own rules. But it ignores my rules. I added the plug-in to parent pom.xml

Where is the problem?

Maven War Plugin Exclude Files

EDIT:

mvn checkstyle:checkstyle -X

Community
File

Maven Checkstyle Configuration

KayserKayser
3,44115 gold badges46 silver badges86 bronze badges

2 Answers

For it to pick up your custom configuration, you need to declare your file as a property:

Taken from my tutorial on how to create a custom CheckStyle check here:
http://blog.blundellapps.com/create-your-own-checkstyle-check/

Source code here:
https://github.com/blundell/CreateYourOwnCheckStyleCheck

Pang
7,19716 gold badges68 silver badges108 bronze badges
BlundellBlundell
59.4k29 gold badges169 silver badges201 bronze badges

Why you don't put your checkstyle config in a directory in parent project like src/main/resources and parametrized the plugin in parent pom.xml like this

Child projects should have access do this configuration

Community
yodamadyodamad
Checkstyle

Maven Checkstyle Exclude Files

Not the answer you're looking for? Browse other questions tagged javamavenconfigurationcheckstyle or ask your own question.