Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
3.1.1
-
None
-
None
Description
When the configuration file and suppressions XML file are inside a JAR, then if the configuration file references the suppressions file with a non-absolute path, the suppressions file cannot be located.
wildfly-checkstyle-config:1.0.8.Final is a plugin dependency of maven-checkstyle-plugin:3.1.1, containing both wildfly-checkstyle/checkstyle.xml and wildfly-checkstyle/suppressions.xml}}
# inside checkstyle.xml we reference suppressions.xml with a absolute path # this doesn't work if the path is changed to non-absolute # wildfly-checkstyle/suppressions.xml, but both absolute/non-absolute reference # work in checkstyle-all.jar <module name="SuppressionFilter"> <property name="file" value="/wildfly-checkstyle/suppressions.xml" /> </module>
The configuration file is wildfly-checkstyle/checkstyle.xml inside the JAR.
Standard Maven project:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>3.1.1</version> <configuration> <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation> <includeTestSourceDirectory>true</includeTestSourceDirectory> <sourceDirectories> <directory>${project.build.sourceDirectory}</directory> </sourceDirectories> <resourceIncludes>**/*.properties,**/*.xml</resourceIncludes> <includeTestResources>true</includeTestResources> <includeResources>true</includeResources> <consoleOutput>true</consoleOutput> <failsOnError>true</failsOnError> <failOnViolation>true</failOnViolation> <propertyExpansion>samedir=/wildfly-checkstyle/</propertyExpansion> </configuration> <dependencies> <dependency> <groupId>org.wildfly.checkstyle</groupId> <artifactId>wildfly-checkstyle-config</artifactId> <version>1.0.8.Final</version> </dependency> <dependency> <groupId>com.puppycrawl.tools</groupId> <artifactId>checkstyle</artifactId> <version>8.36.2</version> </dependency> </dependencies>
This configuraton works but if the reference to suppressions is non-absolute: wildfly-checkstyle/suppressions.xml, then
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Unable to find: wildfly-checkstyle/suppressions.xml at com.puppycrawl.tools.checkstyle.Checker.setupChild (Checker.java:482) at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure (AutomaticBean.java:201) at org.apache.maven.plugins.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle (DefaultCheckstyleExecutor.java:168) at org.apache.maven.plugins.checkstyle.AbstractCheckstyleReport.executeReport (AbstractCheckstyleReport.java:533) at org.apache.maven.plugins.checkstyle.CheckstyleReport.executeReport (CheckstyleReport.java:57) at org.apache.maven.reporting.AbstractMavenReport.generate (AbstractMavenReport.java:255) at org.apache.maven.reporting.AbstractMavenReport.execute (AbstractMavenReport.java:143) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
Using checkstyle-8.36.2-all.jar on the command line works whether the path reference has the leading '/' or not.
Attachments
Issue Links
- is fixed by
-
MCHECKSTYLE-399 Upgrade Checkstyle to 8.41.1
- Closed