码迷,mamicode.com
首页 > 系统相关 > 详细

How to set up Maven to use on Ubuntu

时间:2017-01-03 07:59:40      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:ons   -o   win   into   let   session   this   des   tps   

0. make sure you have java installed and JAVA_HOME specified. 

1. download Maven 3 from https://maven.apache.org/download.cgi

2. unzip maven directory to your desired directory: e.g. /home/rui/apache-maven-3.3.9

3. add maven environmental parameters into your /etc/environment file. (Note: use export to add environment will not work permanently. It only work during your terminal session. If you close your terminal and open a new one, it will not work). 

- in your terminal, type

sudo vim /etc/environment

- then add the following: 

M2_HOME="home/rui/apache-maven-3.3.9"
export M2_HOME
M2=$M2_HOME/bin
export M2

PATH=$PATH:$JAVA_HOMe
PATH=$PATH:$M2
export PATH

- save this file by type ESC then :wq

4. in your terminal, execute 

source /etc/environment

5. verify maven installation: type mvn -version. If you see:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: /home/rui/apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-57-generic", arch: "amd64", family: "unix"

Then you are good to go. Enjoy. 

 

REFERENCE:

[1] how to setup maven path: http://askubuntu.com/questions/275704/how-to-permanently-set-environmental-variables-path-and-m2-home-in-ubuntu-for-ma

[2] how to completely remove all java installation: http://askubuntu.com/questions/84483/how-to-completely-uninstall-java

[3] install java 8 and setup java environmental variable: http://askubuntu.com/questions/605998/installing-java-8-and-setting-environment-variables

How to set up Maven to use on Ubuntu

标签:ons   -o   win   into   let   session   this   des   tps   

原文地址:http://www.cnblogs.com/RuiYan/p/6243636.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!