问题
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/binto your$PATHbefore/usr/local/binto pick up themvnscript that does not override$JAVA_HOMESet
$JAVA_HOMEin your environment or.mavenrcto pick up the your preferred version of Java
来源:https://stackoverflow.com/questions/63336020/how-to-install-maven-with-brew-but-without-openjdk