我需要从源代码构建 kotlin-stdlib/kotlin-reflect (版本 1.9.22)。 我已将 JAVA_HOME 设置为 Java 17 并使用了
./gradlew build
。
但出现错误:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':kotlin-stdlib:compileMainJdk7KotlinJvm'.
> Unable to download toolchain matching the requirements ({languageVersion=7, vendor=any, implementation=vendor-specific}) from 'https://api.foojay.io/disco/v3.0/ids/45dfb704e8dcceab434285501d74cd33/redirect'.
> Provisioned toolchain '/home/xxx/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64' could not be probed: Command returned unexpected result code: 6
Error output:
Error: dl failure on line 1093
Error: failed /home/xxx/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64/jre/lib/amd64/server/libjvm.so, because /home/xxx/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64/jre/lib/amd64/server/../../../../etc/orca/lib/liborca.so.0: file too short
/home/xxx/.gradle/jdks/zing20
不存在。
我已下载并解压 zing20.09.1.0-1-jdk7.0.272-linux_x64.tar.gz
并再次运行。出现这个错误
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':kotlin-stdlib:compileMainJdk7KotlinJvm'.
> Unable to download toolchain matching the requirements ({languageVersion=7, vendor=any, implementation=vendor-specific}) from 'https://api.foojay.io/disco/v3.0/ids/45dfb704e8dcceab434285501d74cd33/redirect'.
> Provisioned toolchain '/home/xxx/.gradle/jdks/zing20/zing20.09.1.0-1-jdk7.0.272-linux_x64' could not be probed: Command returned unexpected result code: 1
Error output:
Zing VM Error: Zing License Verification failed - no valid license found.
有没有办法在没有 zing20 的情况下构建 kotlin-stdlib/kotlin-reflect ?
谢谢
此问题是缺少 Java 7 的问题。要解决此问题,有两种可能性:
$HOME/.m2/toolchains.xml
local.properties
(在kotlin
项目的根目录中)属性kotlin.build.isObsoleteJdkOverrideEnabled=true
- Java 8将用于编译Java 7相关类