问题
I already have Java HotSpot JDK 11 on my machine that I'm using for everything.
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
.
So, how can I tell it to not install openjdk
?
回答1:
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:
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
Set
$JAVA_HOME
in your environment or.mavenrc
to pick up the your preferred version of Java
来源:https://stackoverflow.com/questions/63336020/how-to-install-maven-with-brew-but-without-openjdk