You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Sylwester Lachiewicz (Jira)" <ji...@apache.org> on 2021/04/05 20:06:00 UTC
[jira] [Commented] (MCHECKSTYLE-398) suppressions inside JAR,
non-absolute path, cannot be found
[ https://issues.apache.org/jira/browse/MCHECKSTYLE-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17315072#comment-17315072 ]
Sylwester Lachiewicz commented on MCHECKSTYLE-398:
--------------------------------------------------
I have upgraded Checkstyle to the latest version, could you verify with the latest snapshot from the master branch?
> suppressions inside JAR, non-absolute path, cannot be found
> -----------------------------------------------------------
>
> Key: MCHECKSTYLE-398
> URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-398
> Project: Maven Checkstyle Plugin
> Issue Type: Bug
> Components: checkstyle:checkstyle
> Affects Versions: 3.1.1
> Reporter: CHAN Shih-Ping
> Priority: Major
> Fix For: 3.2.0
>
>
> 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}}}}
>
> {code:java}
> # 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>{code}
> The configuration file is {{wildfly-checkstyle/checkstyle.xml}} inside the JAR.
> Standard Maven project:
> {code:xml}
> <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>
> {code}
> This configuraton works but if the reference to suppressions is non-absolute: {{wildfly-checkstyle/suppressions.xml}}, then
> {code:java}
> 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)
> {code}
> Using checkstyle-8.36.2-all.jar on the command line works whether the path reference has the leading {{'/'}} or not.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)