问题描述
我已经在我用于所有事物的机器上安装了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:
-
在
/usr/local/bin
之前的$PATH
中添加/usr/local/opt/maven/libexec/bin
,以选择不会覆盖$JAVA_HOME
Add
/usr/local/opt/maven/libexec/bin
to your$PATH
before/usr/local/bin
to pick up themvn
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!