Reputation: 1
Here is the path variables echo $PATH /Downloads/apache-maven-3.8.4/bin:/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home
nano .zshrc
export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
plugins=(git zsh-autosuggestions mvn)
export M2_HOME=/Downloads/apache-maven-3.8.4
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
source .zshrc
Using macOs Big Sur
Upvotes: 0
Views: 1032
Reputation: 1
Instead of the following,
export M2_HOME=/Downloads/apache-maven-3.8.4
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
could you please try -
mv apache-maven-{your-version} /Applications/
export JAVA_HOME=$(/usr/libexec/java_home)
export M2_HOME=/Applications/apache-maven-3.9.6
export PATH=$PATH:$M2_HOME/bin
I was also searching for help, then this worked for me so thought of posting it as if that can be helpful!, Thanks!
I tried one more method(macOS Sonoma), this also seems to work :
1.chown -R root:wheel Downloads/apache-maven-3.9.6
2.sudo mv Downloads/apache-maven-3.9.6 /opt/apache-maven
3.nano ~/.zshenv
export PATH=$PATH:/opt/apache-maven/bin
4.source ~/.zshenv
5.Restart your terminal
I hope that helps
Upvotes: 0