How to resolve ${samedir} in a gradle build script?

I use Checkstyle for static code-analysis. I also use a Checkstyle-plugin for eclipse as well as the Checkstyle-plugin for Gradle.

The plugin for Eclipse allows to use the variable ${samedir} to refer to a suppress.xml-file that resides in the same folder als the checkstyle-configuration file (!/properties). This is in particular helpful when using a remote checkstyle-configuration file (

<module name="SuppressionFilter">
  <property name="file" value="${samedir}suppress.xml"/>

I’d really like to use the same checkstyle-configuration in Eclipse and Gradle. Unfortunately, the Gradle-plugin seems to be unable to resolve the variable ${samedir} by default.

Is there a way to use ${samedir} or do I have to use an absolute path to refer to a suppression-file?

See also:


you can configure properties used in checkstyle configurations in your build script like this:

apply plugin:'checkstyle'
checkstyle {
    configProperties['samedir'] = project.projectDir
1 Like