首页 > 代码库 > Java SpringBoot搭建微服务,配置maven

Java SpringBoot搭建微服务,配置maven

一:配置maven

1.下载maven,选择Binary tar.gz,解压拷贝到目录/usr/local/

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

2.配置系统默认maven路径,打开配置文件

 $ open ~/.bash_profile

   写入路径信息

export M2_HOME=/usr/local/apache-maven-3.3.9
export PATH=$PATH:$M2_HOME/bin

   使之生效

$ source ~/.bash_profile

3.检查:

输入mvn -v查看Maven是否安装成功

4.替换maven源,阿里云的源:

打开maven配置文件,比如:

$ open /usr/local/apache-maven-3.3.9/conf/settings.xml

找到<mirrors></mirrors>标签对

添加后的效果为:

  <mirrors>

    <mirror>  
      <id>alimaven</id>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>  
    </mirror>  

  </mirrors>

 

Java SpringBoot搭建微服务,配置maven