Gradle错误- java.lang.NoClassDefFoundError:org/gradle/internal/hash/HashUtil

bpzcxfmw  于 11个月前  发布在  Java
关注(0)|答案(2)|浏览(127)

当我尝试在我的系统上执行命令:gradle clean build时,出现以下错误。

PS C:\Users\my-spring-boot-project> gradle clean build --stacktrace

FAILURE: Build failed with an exception.

* Where:
Settings file 'C:\Users\my-spring-boot-project\settings.gradle' line: 16

* What went wrong:
A problem occurred evaluating settings 'connectedhome-decision-support-tool-backend'.
> org/gradle/internal/hash/HashUtil

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'my-spring-boot-project'.
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
....
....
....
Caused by: java.lang.NoClassDefFoundError: org/gradle/internal/hash/HashUtil
        at org.kordamp.gradle.util.Cache$Key.<init>(Cache.groovy:42)
        at org.kordamp.gradle.util.Cache$Key.<init>(Cache.groovy)

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

字符串

settings.gradle是:

buildscript {
    repositories {
        mavenLocal()
        maven {
            url = "${artifactory_url}/${artifactory_repoKey}"
            credentials {
                username  "${artifactory_username}"
                password  "${artifactory_password}"
            }
        }
    }
    dependencies {
        classpath 'com.my-company.gradle:parentbuild-spring-boot:1.1.90'
    }
}
apply plugin: 'com.my-company.gradle.parentbuild.spring-boot' ----------------> Line 16, Error on this line

rootProject.name = 'my-spring-boot-project'

我的版本是:

Java版本“11.0.11”2021-04-20 LTS
Gradle 7.3.3
如果有关系:IntellIJ版本为IntellIJ IDEA 2021.2.3
我对Gradle很陌生。有人能帮忙吗?

yqhsw0fo

yqhsw0fo1#

它看起来像是来自https://github.com/kordamp/kordamp-gradle-plugins/blob/master/plugins/base-gradle-plugin/src/main/groovy/org/kordamp/gradle/util/Cache.groovy
此提交将删除对更高版本Gradle的引用:
https://github.com/kordamp/kordamp-gradle-plugins/commit/b53171c9ecc61c40479e9d9044d4419b785bdc3e#diff-fe302b433f2713f6834e849752ebfbf8f326e6bf79385448e11bb34bfa5dd253L23
文档在这里https://kordamp.org/kordamp-gradle-plugins/
检查kordamp的构建:

dependencies {
  classpath 'org.kordamp.gradle:settings-gradle-plugin:0.45.0'
  classpath "org.kordamp.gradle:java-project-gradle-plugin:0.45.0"
}

字符串
并确保它有0.46.0或更高版本。

3htmauhk

3htmauhk2#

我也有同样的问题。
在参考了这个https://github.com/kordamp/kordamp-gradle-plugins/issues/489之后,我更新了gradle-wrapper.properties,以使用兼容版本(6.9.1)的gradle for Java 11,解决了这个问题。

distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip

字符串

相关问题