gpt4 book ai didi

Gradle 3.1 给出错误 : "Build failed with exception, Could not initialize class" for any command

转载 作者:行者123 更新时间:2023-12-03 04:01:27 24 4
gpt4 key购买 nike

我刚刚在我的 Centos 7 CM 上安装了 Gradle,两者都使用 sdkmanwget正如 Offical Gradle website 上的建议

我还设置了GRADLE_HOME到正确的目录。

但是,当我运行 gradle -v --debug我明白了:

10:01:03.295 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: /root/.gradle/native

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.fusesource.jansi.internal.CLibrary

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

怎么了?

更新
安装 gradle-2.14.1gradle-3.0似乎工作正常!

最佳答案

列出的第一个解决方案是使其工作的一种方法,但我怀疑原始人可能将他们的/tmp 目录安装为 noexec,如果是这种情况,那么就有一个不那么激烈的解决方案。

临时解决方法(如果使用包装脚本)是更改 gradlew 以包含此内容或类似内容,以便将 jansi .so 文件提取到未安装 noexec 的某个临时位置:

DEFAULT_JVM_OPTS="-Dlibrary.jansi.path=${HOME}/.gradle"

顺便说一句,您不能将此值推送到 gradle.properties 系统属性中,因为此类在加载这些属性之前就已加载。

jansi 1.13 似乎包含 2014 年以来的旧版本 hawtjni,但即使是最新版本似乎也做了同样的事情:
https://github.com/fusesource/hawtjni/blob/3d3aa0be17cc8d35e251ea3594b1e684ce919d0d/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java#L153

由于这部分代码,您可以调整 -Djava.io.tmpdir:
https://github.com/fusesource/hawtjni/blob/3d3aa0be17cc8d35e251ea3594b1e684ce919d0d/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java#L227

如果 ClassDefNotFound 错误会显示 UnsatisfiedLinkError 并可能提示无法从/tmp 加载共享库,那就太好了,但它不会,即使是原因的一部分。

Gradle 在内部将此系统属性设置为 gradleUserHome 目录之类的东西似乎应该是微不足道的,但有趣的是,在代码中发生这种情况的地方是在日志子项目中,它没有任何简单的方法来依赖已经存在的其他 2 个子项目有方便的类来查找 gradleUserHome。

关于Gradle 3.1 给出错误 : "Build failed with exception, Could not initialize class" for any command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39612042/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com