[
https://issues.apache.org/jira/browse/MCHECKSTYLE-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
CHAN Shih-Ping updated MCHECKSTYLE-398:
---------------------------------------
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`:
{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.
was:
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
{code:java}
<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.
> 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
>
> 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)