须知:请确认jdk安装并配置完成并且jdk版本必须1.7以上,可根据Java安装配置环境变量进行安装
一、下载Maven
-
官网下载地址:http://maven.apache.org/download.cgi
-
找到 apache-maven-3.6.2-bin.zip 并点击下载
二、解压Maven并创建本地仓库目录
路径中不要出现空格和中文
将刚刚下载的免安装包解压到某个位置
在硬盘找个地方创建一个目录当作本地仓库
* 参考:`D:\SoftWare_Workspace\maven_repository`
三、配置环境变量
1.在系统变量中新增变量MAVEN_HOME
,值为maven安装目录
2.在Path
中增加%MAVEN_HOME%\bin
3. 验证安装:cmd窗口执行命令:mvn -v
四、配置本地仓库
1.打开Maven安装目录下conf\settings.xml
2.在settings标签下新增
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; font-size: 12px; margin-top: 0px; margin-bottom: 16px; overflow-wrap: break-word; padding: 10px; overflow: auto; line-height: 1.6; background: rgb(246, 246, 246); border-radius: 3px; border: 1px solid rgb(221, 221, 221); white-space: pre-wrap; color: rgb(36, 41, 46); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">
- ``
<localRepository>D:\SoftWare_Workspace\maven_repository</localRepository>
</pre>
五、配置远程仓库
1.打开Maven安装目录下conf\settings.xml
2.在mirrors标签下新增
<pre class="prettyprint linenums prettyprinted" style="box-sizing: border-box; font-family: "YaHei Consolas Hybrid", Consolas, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace; font-size: 12px; margin-top: 0px; margin-bottom: 16px; overflow-wrap: break-word; padding: 10px; overflow: auto; line-height: 1.6; background: rgb(246, 246, 246); border-radius: 3px; border: 1px solid rgb(221, 221, 221); white-space: pre-wrap; color: rgb(36, 41, 46); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
</pre>