Maven 3.0.4 installation to Ubuntu mvn not found

maven, ubuntu

Solution

Had the same issue, this is how i solved it.

1- Install Maven2 from Synaptic rather than downloading it from the website.

2- `gedit ~/.bashrc` and check if you have M2_HOME and M2 env variables defined if so DELETE them, delete them from PATH too, if there is a reference to them.

3- Reload bash and try`mvn --version` again.

Problem

I tried to install Maven to Ubuntu but something goes wrong. I downloaded Maven and untarred it to folder `/usr/local/apache-maven/apache-maven-3.0.4.` Then I added these rows to /etc/environment. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4 export M2=$M2_HOME/bin PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME:$JRE_HOME:$M2:$PATH" But when I try to verify my installation by `mvn --version` I get this message 'The program 'mvn' can be found in the following packages: * maven * maven2 Try: sudo apt-get install ' SOLVED. Sorry that if forget to reply to this. I added export rows to ~/.bashrc and after that it started to work.

Original source