maven下载

下载地址:https://maven.apache.org/download.cgi

jdk要求

maven在windows及linux环境下安装

 

 

maven在windows及linux环境下安装

maven在windows下安装

 maven在windows及linux环境下安装

解压到D盘

maven在windows及linux环境下安装

修改配置文件

进入conf,打开settings.xml文件

指定本地仓库地址

maven在windows及linux环境下安装

配置镜像地址

maven在windows及linux环境下安装

最好就是阿里云:

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

 

如果有多个镜像仓库,id要不一样,也就是说id要唯一
mirrorOf里面,*表示所有访问都使用该镜像仓库
name可以随便命名

 

新建系统变量:MAVEN_HOME=D:\apache-maven-3.6.1

maven在windows及linux环境下安装

 

修改path的值:;%MAVEN_HOME%\bin

maven在windows及linux环境下安装

验证:mvn -version

maven在windows及linux环境下安装

maven在linux下安装

安装包上传到linux服务器,解压

maven在windows及linux环境下安装

maven在windows及linux环境下安装

修改本地仓库地址

maven在windows及linux环境下安装

默认为

maven在windows及linux环境下安装

改为

maven在windows及linux环境下安装

配置镜像地址

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

 

配置环境变量

maven在windows及linux环境下安装

 

# maven
export MAVEN_HOME=/usr/local/apache-maven-3.6.1
export PATH=$MAVEN_HOME/bin:$PATH

maven在windows及linux环境下安装

激活配置

source /etc/profile

maven在windows及linux环境下安装

验证

maven在windows及linux环境下安装

maven在windows及linux环境下安装

 

相关文章: