Maven 3 Homebrew Install
Traditionally, I’ve just downloaded the tar and set a couple of environment variables manually but I wanted to use Homebrew for the install to make things a bit simpler. As it turned out installing via Homebrew caused the following classpath issue:
Because Homebrew uses a non-default directory structure and symlinks to directories under /usr/local/Cellar/maven/3.0.1/libexec, the classpath is not resolved correctly.
I’ve used IntelliJ IDEA for years as my primary Java IDE. I also ran into an issue where IDEA did not recognize the M2_HOME and M2 environment variables defined in my ~/.bash_profile. This was apparent if I tried using the Maven plugin for IDEA to run a goal.
By adding the following to ~/.MacOSX/environment.plist, I was able to solve both of the above problems:
Note that I set the M2_HOME variable to point to /usr/local/Cellar/maven/3.0.1/libexec instead of /usr/local/Cellar/maven/3.0.1. In order for the changes to be picked up you will have to log out and log back in or restart.
For more information on environment.plist, look here.