情况
我正在尝试构建https://github.com/JetBrains/kotlin-mpp-example项目,但该任务compileKotlinIos
总是失败,因为它试图使用 Java 10 来运行konanc
一个java.endorsed.dirs
参数。
使用 --info 运行时的任务详细信息:
Run tool: konanc with args: -g -ea -target ios_arm64 -p library -o /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/build/classes/kotlin/ios/main/greeting.klib -Xmulti-platform /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/iosMain/kotlin/ios.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Calculator.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/common.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Factory.kt -Xcommon-sources=/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/iosMain/kotlin/ios.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Calculator.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/common.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Factory.kt
Starting process 'command '/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java''. Working directory: /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting Command: /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java -DCVS_PASSFILE=~/.cvspass -D__idea.mac.env.lock=unlocked -Dapple.laf.useScreenMenuBar=true -Dawt.toolkit=sun.lwawt.macosx.LWCToolkit -Dcom.apple.mrj.application.live-resize=false -Dcom.jetbrains.suppressWindowRaise=false -Dfile.encoding.pkg=sun.io -Dfile.separator=/ -Dftp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16 -DgopherProxySet=false -Dhttp.nonProxyHosts=local|*.local|169.254/16|*.169.254/16 -Didea.cycle.buffer.size=1024 -Didea.dynamic.classpath=false -Didea.executable=idea -Didea.fatal.error.notification=disabled -Didea.home.path=/Applications/IntelliJ IDEA.app/Contents -Didea.java.redist=jdk-bundled -Didea.jre.check=true -Didea.max.content.load.filesize=20000 -Didea.max.intellisense.filesize=2500 -Didea.no.launcher=false -Didea.paths.selector=IntelliJIdea2018.2 -Didea.popup.weight=heavy -Didea.registered=true -Didea.smooth.progress=false -Didea.xdebug.key=-Xdebug -Dio.netty.machineId=28:f0:76:ff:fe:16:65:0e -Dio.netty.processId=27964 -Dio.netty.serviceThreadPrefix=Netty -Djava.awt.graphicsenv=sun.awt.CGraphicsEnvironment -Djava.awt.headless=true -Djava.awt.printerjob=sun.lwawt.macosx.CPrinterJob -Djava.class.path=/Users/josephivie/.gradle/wrapper/dists/gradle-4.9-all/491wbe0x5d54n9cojs2p0zv90/gradle-4.9/lib/gradle-launcher-4.9.jar -Djava.class.version=54.0 -Djava.endorsed.dirs=/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/lib/endorsed -Djava.home=/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home -Djava.library.path=/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/nativelib -Djava.net.preferIPv4Stack=true -Djava.rmi.server.disableHttp=true -Djava.rmi.server.hostname=127.0.0.1 -Djava.runtime.name=OpenJDK Runtime Environment -Djava.runtime.version=10+46 -Djava.specification.name=Java Platform API Specification -Djava.specification.vendor=Oracle Corporation -Djava.specification.version=10 -Djava.util.concurrent.ForkJoinPool.common.threadFactory=com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory -Djava.vendor=Oracle Corporation -Djava.vendor.url=http://java.oracle.com/ -Djava.vendor.url.bug=https://youtrack.jetbrains.com -Djava.vendor.version=18.3 -Djava.version=10 -Djava.version.date=2018-03-20 -Djava.vm.compressedOopsMode=Zero based -Djava.vm.info=mixed mode -Djava.vm.name=Java HotSpot(TM) 64-Bit Server VM -Djava.vm.specification.name=Java Virtual Machine Specification -Djava.vm.specification.vendor=Oracle Corporation -Djava.vm.specification.version=10 -Djava.vm.vendor="Oracle Corporation" -Djava.vm.version=10+46 -Djavax.swing.rebaseCssSizeMap=true -Djb.vmOptionsFile=/Applications/IntelliJ IDEA.app/Contents/bin/idea.vmoptions -Djbre.popupwindow.settype=true -Djdk.debug=release -Djdk.http.auth.tunneling.disabledSchemes="" -Djna.encoding=UTF8 -Djna.loaded=true -Djna.nosys=true -Djna.platform.library.path=/usr/lib:/usr/lib -Djna.tmpdir=/Users/josephivie/Library/Caches/IntelliJIdea2018.2/tmp -Djnidispatch.path=/Users/josephivie/Library/Caches/IntelliJIdea2018.2/tmp/jna7643917077474273781.tmp -Dkonan.home=/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008 -Dkotlin.environment.keepalive=true -Dlibrary.jansi.path=/Users/josephivie/.gradle/native/jansi/1.14/osx -Dline.separator=
-Dlog4j.defaultInitOverride=true -Dos.arch=x86_64 -Dos.name=Mac OS X -Dos.version=10.13.6 -Dpath.separator=: -DsocksNonProxyHosts=local|*.local|169.254/16|*.169.254/16 -Dsun.arch.data.model=64 -Dsun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/lib -Dsun.cpu.endian=little -Dsun.cpu.isalist -Dsun.io.unicode.encoding=UnicodeBig -Dsun.java.command=org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.9 -Dsun.java.launcher=SUN_STANDARD -Dsun.jnu.encoding=UTF-8 -Dsun.management.compiler=HotSpot 64-Bit Tiered Compilers -Dsun.os.patch.level=unknown -Dswing.bufferPerWindow=true -Duser.dir=/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting -Duser.home=/Users/josephivie -Duser.name=josephivie -Duser.timezone=America/Denver -Xmx3G -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/var/folders/5t/k58d6sjd1xl2qg82vksmk2qr0000gn/T/ -Duser.country=US -Duser.language=en -Duser.variant -ea -cp /Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/kotlin-stdlib.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/klib.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/Runtime.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/protobuf-java-2.6.1.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/shared.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/kotlin-script-runtime.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/kotlin-compiler.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/kotlin-reflect.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/konan.metadata.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/utilities.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/backend.native.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/StubGenerator.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/konan.serializer.jar:/Users/josephivie/.konan/kotlin-native-macos-0.9.2-dev-4008/konan/lib/Indexer.jar org.jetbrains.kotlin.cli.utilities.MainKt konanc -g -ea -target ios_arm64 -p library -o /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/build/classes/kotlin/ios/main/greeting.klib -Xmulti-platform /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/iosMain/kotlin/ios.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Calculator.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/common.kt /Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Factory.kt -Xcommon-sources=/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/iosMain/kotlin/ios.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Calculator.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/common.kt,/Users/josephivie/Documents/GitHub/kotlin-mpp-example/greeting/src/commonMain/kotlin/Factory.kt
Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/bin/java''
-Djava.endorsed.dirs=/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/lib/endorsed is not supported. Endorsed standards and standalone APIs
Error: Could not create the Java Virtual Machine.
in modular form will be supported via the concept of upgradeable modules.
Error: A fatal exception has occurred. Program will exit.
问题
这应该如何处理?可以以某种方式将其更改为使用 Java 8,或禁用其中一些标志,或者这只是一个我必须等待的错误?
我尝试过的事情
从这个问题,我尝试
gradle.properties
在项目的根目录中创建一个文本org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/
。从上面的问题,我无法找到一个
gradle.properties
in~/.gradle
。我尝试将 IntelliJ 设置中的 Gradle JVM 设置为 JDK 8