Optional treeWalker.cacheFile property must not be required
-----------------------------------------------------------

                 Key: MCHECKSTYLE-159
                 URL: http://jira.codehaus.org/browse/MCHECKSTYLE-159
             Project: Maven 2.x Checkstyle Plugin
          Issue Type: Bug
    Affects Versions: 2.6, 2.7
            Reporter: Karsten Tinnefeld


Given a custom checkstyle configuration, checkstyle requires the property 
cacheFile to the TreeWalker module be configured, thus, the following 
configuration cannot go without the property line:

<module name="Checker">
  [...]
  <module name="TreeWalker">
    <property name="cacheFile" value="$\{cachefile\}"/>
    [...]
  </module>
  [...]
</module>

In case it is omitted, the tool exits with the following stack trace 
(shortened, regarding version 2.6):

[INFO] Error during page generation

Embedded error: Error rendering Maven report: Failed during checkstyle execution
missing key 'cacheFile' in TreeWalker
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error during page 
generation
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at 
[...]
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: missing key 
'cacheFile' in TreeWalker
        at 
com.puppycrawl.tools.checkstyle.DefaultConfiguration.getAttribute(DefaultConfiguration.java:74)
        at 
org.apache.maven.plugin.checkstyle.DefaultCheckstyleExecutor.getConfiguration(DefaultCheckstyleExecutor.java:270)
        ... 28 more

Due to checkstyle documentation, the property is optional, and no cachefile 
will be used in case it is not specified (cf. 
http://checkstyle.sourceforge.net/config.html#TreeWalker). Also, cacheFile can 
be specified in the pom, thus it should be substituted anyway.

Workaround:

Add <configuration/>-Entry

  <propertyExpansion>
    cacheFile=${project.build.directory}/checkstyle-cachefile
  </propertyExpansion>

and use the above property line and a special maven build version of the 
checkstyle configuration file.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to