Skip to content

Commit 97ba480

Browse files
committed
Fix Checkstyle to rely on the absolute path
It turns out that relative path in the property `<property name="file" value="src/checkstyle/checkstyle-suppressions.xml"/>` in some cases is resolved against a Gradle deamon dir as a root for configs * Fix Checkstyle plugin config to use an absolute path in the project for the `configDirectory`. * Since `configDirectory` is exposed as a Checkstyle config variable, we can use its `${config_loc}` placeholder to rely on the absolute path in the project
1 parent 4180b92 commit 97ba480

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ subprojects { subproject ->
256256
}
257257

258258
checkstyle {
259-
configFile = file("${rootDir}/src/checkstyle/checkstyle.xml")
259+
configDirectory.set(rootProject.file("src/checkstyle"))
260260
toolVersion = '8.24'
261261
}
262262

src/checkstyle/checkstyle.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<module name="Checker">
66

77
<module name="SuppressionFilter">
8-
<property name="file" value="src/checkstyle/checkstyle-suppressions.xml"/>
8+
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
99
</module>
1010

1111
<!-- Root Checks -->
1212
<module name="RegexpHeader">
13-
<property name="headerFile" value="src/checkstyle/checkstyle-header.txt"/>
13+
<property name="headerFile" value="${config_loc}/checkstyle-header.txt"/>
1414
<property name="fileExtensions" value="java"/>
1515
</module>
1616
<module name="NewlineAtEndOfFile">

0 commit comments

Comments
 (0)