How to install maven with brew but without openjdk?

我与影子孤独终老i 提交于 2020-08-26 03:21:22

问题


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:

  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

  2. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!