Gradle 构建失败并出现错误 checkstyleMain FAILED

use*_*727 5 java checkstyle gradle

我最近升级了我的项目。

   spring boot: 2.1.6 
   gradle: 4.10.2 
   java version 11
   jacoco : 0.8.1
   checkstyle: 8.1
Run Code Online (Sandbox Code Playgroud)

我的项目构建失败并出现错误:

任务:checkstyleMain 失败

.gradle\daemon\4.10.2\etc\checkstyle\checkstyle-suppressions.xml(系统找不到指定的路径)

这是我的 gradle 构建文件:

    jacoco {
       toolVersion = '0.8.1'
    }

    jacocoTestReport {
        afterEvaluate {
           classDirectories = files(classDirectories.files.collect {
                fileTree(dir: it, exclude: [
                       'com/emp/contacts/domain', 
  'com/emp/MyApplication.class'
               ])
           })
       }
   }

   checkstyle {
       toolVersion = '8.1'
       configFile = new File(rootDir, 'etc/checkstyle/checkstyle.xml')
       System.setProperty('checkstyle.cache.file', String.format('%s/%s', 
       buildDir, 'checkstyle.cachefile'))
   }
Run Code Online (Sandbox Code Playgroud)

这是我的项目结构: 在此输入图像描述

Mar*_*ler 2

尝试像这样引用它(这些配置 XML 都可以放入其中):

configFile file("${project.rootDir}/config/checkstyle.xml")
Run Code Online (Sandbox Code Playgroud)

checkstyle-suppressions.xml声明绝对路径时应该找到。