如何安装带有brew但没有openjdk的Maven

如何安装带有brew但没有openjdk的Maven

本文介绍了如何安装带有brew但没有openjdk的Maven?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我用于所有事物的机器上安装了Java HotSpot JDK 11.

I already have Java HotSpot JDK 11 on my machine that I'm using for everything.

当我键入brew install maven时,它尝试安装openjdk作为依赖项.我不想要那样,并且希望Maven使用我的JDK,而不是它自己的openjdk.

When I typed brew install maven it tried to install openjdk as a dependency. I don't want that and want maven to use my JDK, not its own openjdk.

那么,如何告诉我不要安装openjdk?

So, how can I tell it to not install openjdk?

推荐答案

我认为不存在从命令行不安装依赖项的受支持方法.但是,您可以将已安装的mvn配置为使用另一个JDK.它需要两个步骤:

I don't think there is a supported way to not install a dependency from the command line. However, you can configure the installed mvn to use another JDK. It requires two steps:

  1. /usr/local/bin之前的$PATH中添加/usr/local/opt/maven/libexec/bin,以选择不会覆盖$JAVA_HOME

  1. Add /usr/local/opt/maven/libexec/bin to your $PATH before /usr/local/bin to pick up the mvn script that does not override $JAVA_HOME

在您的环境中设置$JAVA_HOME.mavenrc来选择您喜欢的Java版本

Set $JAVA_HOME in your environment or .mavenrc to pick up the your preferred version of Java

这篇关于如何安装带有brew但没有openjdk的Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 06:13