Original address: http://my.oschina.net/hongdengyan/blog/150472
First, environmental description:
Operating system: Ubuntu 14.10 (64-bit)
maven:apache-maven-3.2.2
Install the JDK before you install MAVEN.
Second, download maven
Download Link: http://maven.apache.org/download.cgi
Select the latest version of the MAVEN installation package that I installed when the latest installation package is apache-maven-3.2.2-bin.tar.gz.
The path to download the saved file is: ~/download/.
Three, decompression installation?
Extract:
?
1 |
~/下载$ tar -zxvf apache-maven-3.2.2-bin. tar .gz |
to move the apache-maven-3.2.2 directory to the/usr/local directory:?
1 |
~/下载$ sudo mv apache-maven-3.2.2/ /usr/local/ |
Iv. Setting Environment variables
Open and edit the profile file as root:
?
1 |
~/下载$ sudo gedit /etc/profile |
At the end of the file add:
#set maven Environment
m2_home=/usr/local/apache-maven-3.2.2
Export maven_opts= "-xms256m-xmx512m"
Export path= $M 2_home/bin: $PATH
Save and close.
For the configuration to take effect, you must restart the machine or enter it at the command line:
?
To see if MAVEN was installed successfully:?
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17t21:51:42+08:00)
Maven Home:/usr/local/apache-maven-3.2.2
Java version:1.7.0_60, Vendor:oracle Corporation
Java Home:/usr/local/java/jdk1.7.0_60/jre
Default LOCALE:ZH_CN, Platform Encoding:utf-8
OS name: "Linux", Version: "3.5.0-23-generic", Arch: "I386", Family: "Unix"
V. Configuring user Scope Setting.xml
?
1 |
~/下载$ gedit /usr/local/apache-maven-3 .2.2 /conf/settings .xml |
Found in file
?
123456 |
<!-- localRepository | The path to the local repository maven will use to store artifacts. | | Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> --> |
add content after:
?
12345678 |
<!--localrepository Code class= "XML Spaces" >&NBSP;&NBSP;&NBSP; | The path to the local repository maven would use to store artifacts. &NBSP;&NBSP;&NBSP; | &NBSP;&NBSP;&NBSP; | Default: ${user.home}/.m2/repository &NBSP;&NBSP; <LOCALREPOSITORY>/PATH/TO/LOCAL/REPO</LOCALREPOSITORY> &NBSP;&NBSP; --> < localrepository >${user.home}/repository/maven</ localrepository > |
Where: ${user.home}/repository/maven is the path to your Maven local repository.
Save exit.
Ubuntu install maven (GO)