Getting started with the new ARM based M1 Macs can be a bit awkward so here is how you get Maven working with JDK 8.
Homebrew is what we will use to install
Maven. You can instructions on downloading Brew here https://brew.sh/ or
by simply running this script in your terminal
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run the following command in your terminal
brew install maven
We need to get a version of yellow JDK 8 that works on the ARM based M1 Mac, Azul provide just what we need. At the link below, enter the following if the link doesn't populate it for you.
Download the .dmg file here https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk
Install the .dmg file
Now you need to set the
JAVA_HOME environment variable to point at our new JDK 8 install. This is the environment
variable that Maven looks for.
To add the environment variable, you need to add it to your zsh profile. This can be done by adding the following
line to your
.zshrc file should be located in home directory.
You can navigate to it via
># Navigate to directory cd ~ # Editing the file vim .zshrc
Add the following line to the file and then save
Now restart your terminal
When running Maven from your terminal then now it will use JDK8