maven的安装配置

1、下载并解压maven到本地 如D:workapache-maven-3.5.0

2、配置maven的环境变量

 ①、 新建系统变量M2_HOME  值就是本地的maven所在文件目录 即D:workapache-maven-3.5.0

②、 在path变量后面加上%M2_HOME%bin;

进入cmd,输入mvn -v 验证maven是否安装成功

3、配置maven

打开D:workapache-maven-3.5.0confsettings.xml

     1、maven配置阿里云的镜像

      <mirrors>
      <!-- mirror
       | Specifies a repository mirror site to use instead of a given repository. The repository that
       | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
       | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
       |
      <mirror>
        <id>mirrorId</id>
        <mirrorOf>repositoryId</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://my.repository.com/repo/path</url>
      </mirror>
       -->
       <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>       
      </mirror>
    </mirrors>

    2、maven配置本地仓库

      <localRepository>D:/work/maven/repository</localRepository>

    3、maven配置jdk版本
        <profile>
            <id>jdk-1.7</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.7</jdk>
            </activation>
            <properties>
                <maven.compiler.source>1.7</maven.compiler.source>
                <maven.compiler.target>1.7</maven.compiler.target>
                <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
            </properties>
        </profile>