You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "CHAN Shih-Ping (Jira)" <ji...@apache.org> on 2020/10/28 23:15:00 UTC

[jira] [Created] (MCHECKSTYLE-398) suppressions inside JAR, non-absolute path, cannot be found

CHAN Shih-Ping created MCHECKSTYLE-398:
------------------------------------------

             Summary: 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


When the configuration file and suppressions XML file are inside a JAR, then if the configuration file references the 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}
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)