CentOS7安装MAVEN

一、安装

1. MAVEN下载地址

http://maven.apache.org/download.cgi

2. 安装命令

wget https://downloads.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz
tar -xvf apache-maven-3.8.4-bin.tar.gz 
mv apache-maven-3.8.4 /usr/local/apache-maven

3. 设置环境变量

vim /etc/profile 

最后一行加入

#export JAVA_HOME=/usr/local/jdk1.8
export MAVEN_HOME=/usr/local/apache-maven
export PATH=$MAVEN_HOME/bin:$PATH

4. 生效环境变量

source /etc/profile

二、settings配置添加国内源

vim /usr/local/apache-maven/conf/settings.xml

内容:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
 
<localRepository>/root/.m2/repository</localRepository>
  <pluginGroups>
  <pluginGroup>com.spotify</pluginGroup>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
	    <server>
		   <id>tomcat</id>
		   <username>tomcat</username>
		   <password>tomcat</password>
		</server>
		<server>
			<id>3rdParty</id>
			<username>私有nexus仓库账号</username>
			<password>私有nexus仓库密码</password>
		</server>
  </servers>
  <mirrors>
    <mirror> 
		<id>alimaven</id> 
		<name>aliyun maven</name> 
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
		<mirrorOf>central</mirrorOf> 
	</mirror>
    <mirror> 
		<id>3rdParty</id> 
		<mirrorOf>*</mirrorOf>
		<name>3rdParty</name> 
		<url>私有nexus仓库地址</url> 
	</mirror>
  </mirrors>
  <profiles>
	    <profile> 
		  <id>3rdParty</id> 
		  <repositories> 
			<repository> 
			  <id>3rdParty</id> 
			  <name>3rdParty</name> 
			  <url>私有nexus仓库地址</url> 
			  <releases> 
			  <updatePolicy>always</updatePolicy>
				<enabled>true</enabled> 
			  </releases> 
			  <!-- snapshots默认是关闭的,需要手动开启 --> 
			  <snapshots> 
			  <updatePolicy>always</updatePolicy>
				<enabled>true</enabled> 
			  </snapshots> 
			</repository>
		  </repositories> 
		</profile>
		<profile>
           <id>android</id>
           <properties>
               <android.sdk.path>
                  /root/adt-bundle-windows-x86_64-20140702/sdk
               </android.sdk.path>
        </properties>
        </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>3rdParty</activeProfile>
	<activeProfile>android</activeProfile>
  </activeProfiles>

</settings>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

编程圈子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值