下载

下载maven点击下载

指定文件目录 可选

Mac安装并配置maven_maven

Mac安装并配置maven_apache_02

镜像

Binary zip archive apache-maven-3.6.3-bin.zip

bennyrhysdeMacBook-Pro:.m2 bennyrhys$ vim ~/.bash_profile 
bennyrhysdeMacBook-Pro:.m2 bennyrhys$ source ~/.bash_profile 
bennyrhysdeMacBook-Pro:.m2 bennyrhys$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/bennyrhys/Documents/java_install/apache-maven-3.6.3
Java version: 1.8.0_121, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"

source ~/.path配置文件,使编辑生效。在输入mvn -v

修改maven根目录下的conf文件夹中的setting.xml文件,内容如下:local可以不写

  <localRepository>/Users/shangri-la/.m2/repository</localRepository>
 <mirrors>
    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
  </mirrors>

运行下载 初始化仓库

mvn help:system

还要配置

   <!--配置profiles节点-->
  <profiles>
  <profile>
            <id>jdk-1.8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <repositories>
                <repository>
                    <id>nexus</id>
                    <name>local private nexus</name>
                    <url>http://maven.aliyun.com/nexus/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.aliyun.com/nexus/content/groups/public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
idea使用

Mac安装并配置maven_ide_03