原文連接:http://blog.csdn.net/f_zongjian/article/details/24144803java
/usr/share/java目錄下只有Stubs目錄。apache
下載了lastest version,文件名:apache-maven-3.2.1-bin.tar.gzxcode
tar -xvf ~/Downloads/apache-maven-3.2.1-bin.tar.gz
將解壓在當前目錄下。bash
的apache-maven-3.2.1文件夾移到/usr/local/maven目錄(不存在則新建)下,並重命名爲maven3.2.1
即:maven
/usr/local/maven/maven3.2.1.net
http://maven.apache.org/download.cgi#Installation,
並結合其餘網友貢獻的資料,作如下工做:code
vi ~/.bash_profile
而後輸入
M3_HOME=/usr/local/maven/maven3.2.1xml
PATH=$M3_HOME/bin:$PATHblog
export M3_HOMEci
export PATH
保存退出。
Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
經過
echo $M3_HOME
echo $PATH
可查看剛設置的環境變量。
mvn -version
能夠看到maven的版本信息了。
在maven安裝目錄的conf目錄下,vi settings.xml
第54行左右有這麼一段:
<!-- localRepository The path to the local repository maven will use to store artifacts. Default: ${user.home}/.m2/repository <localRepository>/path/to/local/repo</localRepository> -->
<localRepository>具體的絕對路徑</localRepository>
便可