firemail

标题: centos 7 下安装maven [打印本页]

作者: java    时间: 2018-6-1 14:59
标题: centos 7 下安装maven
本帖最后由 java 于 2018-6-1 19:24 编辑

CentOs7安装maven

1.确保已经安装了java环境
java -version
2.获取maven
wget http://mirror.bit.edu.cn/apache/ ... en-3.5.3-bin.tar.gz

3.安装maven
tar -xvf apache-maven-3.5.3-bin.tar.gz
mv apache-maven-3.5.3 /opt/soft/apache-maven-3.5.3/

[root@localhost apache-maven-3.5.2]# tree -L 1
.
├── bin
├── boot
├── conf
├── lib
├── LICENSE
├── NOTICE
└── README.txt
修改/etc/profile [推荐 ~/.bashrc]文件,将maven加入到环境变量(一般放在该文件最后)
  1. //...
  2. export M2_HOME=/opt/soft/apache-maven-3.5.3
  3. export PATH=${M2_HOME}/bin:${PATH}
复制代码
进入conf目录,修改settings.xml文件

[root@localhost apache-maven-3.5.2]# cd conf/
[root@localhost conf]# ls
logging  settings.xml  toolchains.xml
[root@localhost conf]# cp settings.xml settings.xml.bak //备份配置文件
[root@localhost conf]# vi settings.xml

找到localRepository节点,修改为maven本地仓库

<!-- localRepository
  | The path to the local repository maven will use to store artifacts.
  |
  | Default: ${user.home}/.m2/repository
-->
<!--设置成自己的仓库目录,绝对路径 -->
<localRepository>/opt/soft/mavenrepository/repo</localRepository>






欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3