如何解决Apple M1 - macosx-arm64 尚不可用的 Maven Java 依赖项
我正在尝试让 Java/Maven 项目在 Apple M1 上运行,该项目的依赖项尚不可用于 M1 芯片。就我而言,这是 nd4j,但它可能是任何其他依赖项。
private ApiServiceInterface getApiInstance(Context context) {
HttpLoggingInterceptor logInter = new HttpLoggingInterceptor();
logInter.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient mIntercepter = new OkHttpClient.Builder()
.addInterceptor(logInter)
.build();
String BASE_URL = "http://192.168.0.14:80/api/auth/";
Retrofit retrofitInstance = new Retrofit.Builder()
//.addConverterFactory(new NullOnEmptyConverterFactory())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(BASE_URL)
.client(mIntercepter)
.build();
return retrofitInstance.create(ApiServiceInterface.class);
}
我在这个项目中使用 IntelliJ。
我正在寻找一种方法来指定某种“兼容模式”,告诉 maven/IntelliJ 获取 X86 芯片的依赖项并使用 Rosetta 执行 Java、测试、maven 等。如果这是不可能的,还有什么办法可以解决这个问题?
解决方法
您可以在您的机器上安装基于 x86_64 和基于 arm64 的 JDK,并根据需要在它们之间切换。像SDKMAN这样的工具!可以帮助您:How to install x86 and Arm JDKs on the Mac M1
如果您的 maven 和 IntelliJ 使用默认的 JDK,当您切换 JDK 时,它们会自动在 x86_64 和 Arm64 架构之间切换。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。