How to install previous version of Maven (3.0.4)?
The way my Maven packages are configured, something breaks when I have the latest version installed (I think 3.4). On another computer, where I have 3.0.4, the build runs fine. I am looking for a way to install a previous version using apt-get
. I followed these instructions and they completed fine but when I ran mvm -v
, I got the following error, so something must have been wrong with the tar ball:
[ERROR] Unknown lifecycle phase "–v"
Solution 1:
-
Download and extract the installation package:
cd /opt wget -O- https://archive.apache.org/dist/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz | sudo tar -xzv
Add
/opt/apache-maven-3.0.4/bin
to yourPATH
.
See also http://maven.apache.org/download.cgi.
Solution 2:
This is how I did it.
Download whatever maven build you want. (here 3.0.4)
Download your archived version from https://archive.apache.org/dist/maven/maven-3 (If you are a beginner, go to binaries then download the version with tar.gz extension under version you want. here apache-maven-3.0.4-bin.tar.gz is the file you want)
Then create a link using below command
sudo ln -s /home/menuka/software/apache-maven-3.2.5 /usr/bin/mvn
The first file path should be where you extract the maven from tar.gz second path is you don't need to change. Because it is the Linux way to create an executable link (http://www.linfo.org/usr_bin.html)
Now we have to set up environment variables for maven to work. Run below command with you favorite text editor. I here use beginner-friendly gedit.
sudo gedit /etc/profile.d/apache-maven.sh
Add below content to the editor (Make sure you replace your JAVA_HOME with your jdk path)
export JAVA_HOME=/usr/lib/jvm/java-6-oracle
export M2_HOME=/usr/bin/mvn
export MAVEN_HOME=/usr/bin/mvn
export PATH=${M2_HOME}/bin:${PATH}
Save and exit the editor.
then run below command to update Linux configurations
source /etc/profile.d/apache-maven.sh
now if you completed above process correctly below command give and output
mvn -version