I was not happy about to realize that one of the last Apple updates updated maven to version 3. Maven in it’s new version does brake quite a few concepts which were in version 2, and maven does not go for downwards compatibility.
I had no issues with simple builds, but when I had a multi-module project which requires jars to be installed in the repository maven 3 just started throwing exceptions at me. As my clients still are on maven 2.0+ I was looking for a solution how to downgrade it.
It actually is fairly simple as the update adds a new maven version and modifies the default executable but it doesn’t uninstall previous versions. These steps will give you back what was yours before:
$ cd /usr/share/java
$ ls -q1 | grep maven #check if your desired maven version is there
$ cd .. #go up
$ ls -l | grep maven #check what current version is
maven -> java/maven-3.0.2
$ sudo rm maven #remove unwanted symlink
$ sudo ln -s java/maven-2.2.1 maven #set it to maven 2.2.1
That’s it. To test out if it runs or not just reopen Terminal and enter mvn -version and it will be now version 2.2.1 :)
Popularity: 53% [?]Tags: downgrade, how-to, mac, maven, mvn