带Intellij刷新的java Gradle 6失败
我有一个带有Spring2.1.7的Gradle6.0项目
当我试图从intellij中refresh all gradle projects
我有一个错误:
Unable to load class 'org.gradle.api.internal.plugins.DefaultConvention'. Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
- The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
- Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
我使用intellij v 2018.3.4,并将其配置为使用gradle包装器:
格拉德尔包装。属性如下所示:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
如果我从命令行运行gradle包装器,就不会有问题。如果我触发一个渐变任务(构建、清理…)从Intellij我没有错误
我有另一个有线问题可能与此有关。以我的身材。gradle我使用SpringBoot2.1.7,如果我从命令行运行我的jar,我可以从SpringBoot横幅中看到配置的版本2.1.7。 相反,如果我运行应用程序表单Intellij,我会看到它使用的是Spring Boot 2.0.8,如果我展开External libraries树,我会看到:
建造。格雷德尔看起来像:
buildscript {
ext {
springBootVersion = "2.1.7.RELEASE"
springBootDepManagementVersion = "1.0.8.RELEASE"
}
}
plugins {
id 'idea'
id 'java'
id "io.spring.dependency-management" version "${springBootDepManagementVersion}"
id 'org.springframework.boot' version "${springBootVersion}"
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
....
}
多谢各位
# 1 楼答案
降级也能帮我完成任务:
# 2 楼答案
我解决了将gradle包装降级到5.6.4的问题。 显然,我的Intellij版本不支持gradle 6.0.0