本文介绍了Apple M1 - macosx-arm64 尚不可用的 Maven Java 依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 Java/Maven 项目在 Apple M1 上运行,该项目的依赖项尚不可用于 M1 芯片.就我而言,这是 nd4j,但它可能是任何其他依赖项.

I am trying to get a Java/Maven project working on an Apple M1 with a dependency that is not yet available for the M1 chip. In my case this is nd4j but it could be any other dependency.

<dependency>
   <groupId>org.nd4j</groupId>
   <artifactId>nd4j-native</artifactId>
   <version>1.0.0-beta7</version>
</dependency>

我在这个项目中使用 IntelliJ.

I am using IntelliJ for this project.

我正在寻找一种方法来指定某种兼容模式";这告诉 maven/IntelliJ 获取 X86 芯片的依赖项并使用 Rosetta 执行 Java、测试、maven 等.如果这是不可能的,还有什么办法可以解决这个问题?

I am looking for a way to specify some sort of "compatibility mode" that tells maven/IntelliJ to fetch dependencies for X86 chips and execute Java, the tests, maven, etc. with Rosetta. If that's not possible, what could be other was to solve this?

推荐答案

您可以在您的机器上安装基于 x86_64 和基于 arm64 的 JDK,并根据需要在它们之间切换.像SDKMAN这样的工具!可以帮助您:如何在 Mac M1 上安装 x86 和 Arm JDK

You can install both x86_64 based and arm64 based JDKs on your machine, and switch between these as needed. A tool like SDKMAN! can help you with that: How to install x86 and Arm JDKs on the Mac M1

如果您的 maven 和 IntelliJ 使用默认的 JDK,当您切换 JDK 时,它们会自动在 x86_64 和 Arm64 架构之间切换.

If your maven and IntelliJ use the default JDK, they will automatically switch between x86_64 and Arm64 architecture, when you switch JDKs.

这篇关于Apple M1 - macosx-arm64 尚不可用的 Maven Java 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 03:25