windows和mac差不了多少,只是配置环境变量时不同。
下面进入正题
首先下载maven:https://maven.apache.org/
或者在我的百度网盘下载:链接:https://pan.baidu.com/s/1pbNBt8fLZYWo7ouMRS_VCw 密码:oyzl
mac配置环境变量:
1.打开终端
2.输入 vim ~/.bash_profile
3.按i,进入编辑模式
4.export M2_HOME=你的maven文件路径
5.export M2=$M2_HOME/bin
6.export PATH=$M2:$PATH
7.按exc退出编辑模式
8.输入 :wq!
9.输入source ~/.bash_profile使刚才的配置生效
输入 mvn -v 检查是否成功
在这里插入图片描述
然后打开conf目录下的settings.xml文件,配置下阿里的服务器和你的本地仓库
这个是你的本地仓库,配置好后输入 mvn --help:system 下载很多很多东西。
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups />
<proxies />
<servers />
<localRepository>/Library/apache-maven-3.6.1/repository</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库在中国的镜像 -->
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
打开idea
这三个 都要配。
然后就可以创建maven项目了。
第一个项目先不勾选,
Artifaciid为你的唯一标识。
右下角选择 enable auto-import 这个是自动导入,选择第一个就会每新建一个导入一次
下面创建一下web项目
File—>new—>module
一路next
Over。。。。