Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install maven with brew but without openjdk?

Tags:

homebrew

maven

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?

like image 869
Alex Craft Avatar asked Aug 10 '20 07:08

Alex Craft


People also ask

Can we install Maven without Java?

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.

How do I download and install Maven on Mac?

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.

How do I know if Maven is installed on my Mac?

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.


1 Answers

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
like image 104
Enrique Cordero Avatar answered Sep 20 '22 06:09

Enrique Cordero