openshell 的个人博客

一天很长,但十年很短。

Open Source, Open Mind,
Open Sight, Open Future!
  menu
110 文章
5051 浏览
0 当前访客
ღゝ◡╹)ノ❤️

Linux下Maven安装与配置

Linux下Maven安装与配置

  1. 到官网选择需要的版本http://maven.apache.org/download.cgi#
  2. 下载安装包
[root@localhost ~]# mkdir /usr/local/maven 
[root@localhost ~]# cd /usr/local/maven/
[root@localhost ~]# wget http://us.mirrors.quenda.co/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
  1. 解压并配置
[root@localhost maven]# tar -zxvf apache-maven-3.6.3-bin.tar.gz
[root@localhost maven]# mkdir apache-maven-3.6.3/repo
[root@localhost maven]# vim apache-maven-3.6.3/conf/settings.xml 
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<localRepository>/usr/local/maven/apache-maven-3.6.3/repo</localRepository>
    <mirrors>
<mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
    </mirrors>
  <profiles>
    <profile>
       <id>nexus</id>
        <repositories>
            <repository>
                <id>nexus</id>
                <name>local private nexus</name>
                <url>http://maven.oschina.net/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
        </repositories>

        <pluginRepositories>
            <pluginRepository>
            <id>nexus</id>
            <name>local private nexus</name>
            <url>http://maven.oschina.net/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
        </profiles>
</settings>


  1. 配置环境变量
# set maven env
export M2_HOME=/usr/local/maven/apache-maven-3.6.3
export M2_HOME
export PATH=$PATH:$M2_HOME/bin

使配置生效

source /etc/profile

标题:Linux下Maven安装与配置
作者:openshell
地址:http://solo.caiqz.cn/articles/2020/06/30/1593532214600.html