I installed Java and Maven on my mac.
The default Java install for mac worked fine and setup my JAVA_HOME etc., all fine.
I installed Maven and followed the instructions on my mac. (http://maven.apache.org/download.cgi)
Again fine…
Until I restarted my mac or created a new terminal.
Then I found the additional secret instructions, which I’d forgotten because I’ve been away from Unix for so long.
I needed to edit the bash profile.
As explained in this StackOverflow article “mvn-command-not-found-in-osx”
I needed to:
vi ~/.bash_profile
Then add the lines
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
export M2=$M2_HOME/binexport PATH=$M2:$PATH
I skipped the JAVA_HOME
because when I typed echo $JAVA_HOME
in the terminal it had already been exported correctly. If you had to add the JAVA_HOME
variable during your installation then you might need to add the export for that in your bash_profile as well.
Remember, with vi, to save the file, press ’esc’ and then type ‘:wq’
esc :wq
I then opened a new terminal, and typed mvn and all was well.
You will need a Github account to comment. Or you can contact me with your comment.
I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, etc.