标签:style blog http io ar color os sp java
操作系统:Ubuntu 12.04.2 LTS(32位)
maven:apache-maven-3.2.2
安装maven前请先安装好jdk,jdk安装可参见:http://my.oschina.net/hongdengyan/blog/150342。
下载链接:http://maven.apache.org/download.cgi
选择最新版本的maven安装包,我安装时最新安装包是apache-maven-3.2.2-bin.tar.gz。
下载保存文件的路径是:~/下载/。
1.~$ cd ~/下载
解压:
以root身份打开并编辑profile文件:
在文件最后添加:
#set maven environment
M2_HOME=/usr/local/apache-maven-3.2.2
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2_HOME/bin:$PATH
保存并关闭。
要使配置生效必须重启机器或者在命令行输入:
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"
执行以下语句,自动生成.m2目录:
将/usr/local/apache-maven-3.2.2/conf/settings.xml文件copy到~/.m2目录:
2. ~/下载$
cp
/usr/local/apache-maven-3
.2.2
/conf/settings
.xml ~/.m2/
修改~/.m2/settings.xml文件:
3. ~/下载$ gedit ~/.m2
/settings
.xml
在文件中找到
<!-- 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
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<
localRepository
>${user.home}/repository/maven</
localRepository
>
其中:${user.home}/repository/maven是你maven本地仓库的路径。
保存退出。
文章出自:http://my.oschina.net/hongdengyan/blog/150472
标签:style blog http io ar color os sp java
原文地址:http://www.cnblogs.com/vipdev/p/4122309.html