Skip to content

Commit

Permalink
build.gradle: fix checkstyle plugin failure
Browse files Browse the repository at this point in the history
The `checkstyle` plugin of Gradle fails in JDK11.

The main reason is that, in JDK11, the `user.dir` cannot be reset by Gradle.[1]
So, checkstyle plugin is unable to locate the suppressions file correctly.
Also, the `FileContentHolder` module are deprecated[2].

Let's add ` config_loc` variable suggested by Gradle to solve the problem.[1]

[1] gradle/gradle#8286
[2] checkstyle/checkstyle#5187
  • Loading branch information
fzdy1914 committed Feb 28, 2019
1 parent 2b5d50b commit 85a90e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repositories {

checkstyle {
toolVersion = '8.1'
configDir = file("$rootProject.projectDir/config/checkstyle")
}

jacocoTestReport {
Expand Down
5 changes: 1 addition & 4 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@
</module>

<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml"/>
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>


<!-- All Java AST specific tests live under TreeWalker module. -->
<module name="TreeWalker">

<!-- Required for SuppressionCommentFilter to work -->
<module name="FileContentsHolder"/>

<!-- Required to allow exceptions in code style -->
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
Expand Down

0 comments on commit 85a90e6

Please sign in to comment.