在新的干净的Eclipse安装之后,我遇到了各种Gradle问题。它们似乎与这条“问题”信息有关:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.1.1-bin.zip'.
Initialization script 'Z:\eclipse-workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle'
Could not compile initialization script 'Z:\eclipse-workspace\.metadata\.plugins\org.eclipse.buildship.core\init.d\eclipsePlugin.gradle'.
startup failed:
General error during semantic analysis: Unsupported class file major version 60
java.lang.IllegalArgumentException: Unsupported class file major version 60
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
.....
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:831)
1 error
我已经尝试删除.gradle&“Gradle->刷新Gradle项目”。我也试过这个:stackoverflow
我的Java安装很干净:
java version "16.0.1" 2021-04-20
已确认的Eclipse正在指向它(“Preferences->Java->Installed JRE”)。
安装详细信息:
Buildship: Eclipse Plug-ins for Gradle 3.1.5.v20210113-0929
Eclipse IDE for Java Developers 4.20.0.20210612-1200
Windows 10。
Eclipse安装错误日志:
!ENTRY org.eclipse.buildship.core 2 2 2021-07-09 11:22:05.951
!MESSAGE Initialize project testgradleprj failed due to an error in the referenced Gradle build.
!STACK 0
org.gradle.tooling.BuildException: Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.1.1-bin.zip'.
4条答案
按热度按时间k0pti3hp1#
Gradle 6.8不支持Java 16。
从Gradle 7开始支持Java 16
在以前的Gradle版本中,在Java 16上运行Gradle本身会导致错误。
Https://docs.gradle.org/7.0/release-notes.html#java-16
bzzcjhmw2#
多亏了LMC。我将项目Prefs->Gradle从 Package 器更改为Special=7.1.1:
vd2z7a6w3#
我已经用以下内容更新了Gradle-warpper.properties文件
DistributionUrl=https://services.gradle.org/distributions/gradle-6.4.1-bin.zip来自distributionUrl=https://services.gradle.org/distributions/gradle-5.6.2-bin.zip
并刷新eclipse中的gradlew项目。构建成功注:我的机器上安装了Java 11版本
6vl6ewon4#
更改您的
gradle.properties
文件和
build.gradle
文件