7

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"

1
  • Have you considered trying to fix the build in the current version of Maven? Also, the version of maven in the repos is 3.0.5. May 14, 2014 at 23:01

3 Answers 3

9
  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
    
  2. Add /opt/apache-maven-3.0.4/bin to your PATH.

See also http://maven.apache.org/download.cgi.

3
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

mvn -version output

0

You can Install maven 3.0.4 with ppa:rockclimb/netbeans repository.

sudo add-apt-repository ppa:rockclimb/netbeans

sudo apt-get update

sudo apt-get install maven
1
  • I am not sure whether this is a trustworthy way of installing Maven. Because this will work as long as 3.0.4 is the latest maven version on this repository. Then it will be next version Nov 20, 2019 at 4:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .