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.
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.
please check if mvn
in $M2 is executable. if not you need to make it executable by running
chmod +x mvn
Since Ubuntu 16.04.3 LTS release, Maven can be installed from the official repository by running following commands:
Each time you hit sudo apt update
it will update to the latest version.
Update: After installation is complete, run in the terminal mvn -v
to see if package was installed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.