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
?
Prerequisites. Maven is written in Java. So, to run Maven, we need a system that has Java installed and configured properly. We can download an OS-compatible Java JDK from Oracle's download site, for example.
2.1) Download Maven for Mac OSGo to the Maven Download site: https://maven.apache.org/download.cgi Download the “Binary tar. gz archive” file as shown in the below image. After downloading, extract it using the below command. The binaries will be extracted in the “apache-maven-3.6.
Some of the Mac OS X versions comes with Maven 3 built in, installation located at /usr/share/maven . To test Maven installed or not in your Mac issue command mvn -v in Terminal, it shows you installed version if already installed otherwise error.
The way I solved it was installing the openjdk with brew (in my case openjdk@8). Mine was different from the default one that brew requires by default. So after that I created a symlink to my openjdk where maven is expecting to find the SDK. And finally installed maven without dependencies.
brew install openjdk@8
cd /usr/local/opt
ln -s ../Cellar/openjdk@8/1.8.0+275 openjdk
brew install --ignore-dependencies maven
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With