Checkstyle plugin: is "cacheFile" property supported?


(Egor Andreevici) #1

I’m trying to migrate a project from Maven to Gradle. The project had a Checkstyle configuration with a custom checkstyle.xml file. Right now I’m getting build failures pointing to this part:

<module name="Checker">
  <module name="TreeWalker">
    <module name="FileContentsHolder"/>

    <property name="cacheFile" value="${checkstyle.cache.file}"/>

I can’t find how the checkstyle.cache.file property was set on Maven side, but I’m guessing the Maven plugin had a non-null default. Does Gradle Checkstyle plugin support the cacheFile property, or is there any other way to set it?

(James Justinic) #2

You wouldn’t really care about cacheFile itself as that part is handled entirely by checkstyle and the checkstyle configuration file and could even be hard-coded to a certain location. If you’re using a configuration property, in the context of the plugin, you only care about how setting that property is supported (i.e. checkstyle.cache.file, not cacheFile).

You can set as many configuration properties as you want. For example,

checkstyleMain {
    configProperties += ['checkstyle.cache.file': file('checkstyleCacheFile')]

(Egor Andreevici) #3

Thanks, that’s definitely something I can work with!