maven安装与配置

一、安装

1、下载maven、解压(https://us.mirrors.quenda.co/apache/maven/maven-3/3.5.4/binaries/)

 

 

 

 2、新建文件夹解压文件

3、配置环境变量(MAVEN_HOME="安装目录")

配置bin的目录(%MAVEN_HOME%\bin)

 

 

 二、配置maven(优先级:本地仓库>私服>公共仓库>中央仓库(不用自己配置))

1、本地仓库的配置,创建一个文件夹作为本地仓库地址

1.1在maven的conf目录下找到settings.xml文件。在根目录下配置<localRepository>创建的本地仓库的地址</localRepository>

 

 2、配置jdk

在profiles标签下配置

<profile>
    <id>myjdk</id>
    <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
    </activation>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
</profile>

  在profiles同级标签下配置如下标签,使配置的jdk生效。

<activeProfiles>
    <activeProfile>myjdk</activeProfile>
  </activeProfiles>

 3、配置aliyun公共仓库,在mirrors标签下做如下配置

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

 

posted @ 2020-11-02 20:04  陈南北  阅读(2390)  评论(0编辑  收藏  举报