Maven安装与配置(超详细)

Maven安装与配置(超详细)

一.下载:
官方下载,下载页面:http://maven.apache.org/download.cgi(这边选择apache-maven-3.8.1-bin.zip,点击下载)
在这里插入图片描述

二.安装:
下载完成后,选择一个路径进行解压(路径切记不要有中文,特殊字符)
在这里插入图片描述
三.配置环境
maven 的使用是在jdk的基础上,所以电脑必须有jdk
1.右击“我的电脑”–>“属性”–>“高级系统设置”–>“高级”–>“环境变量”,在打开的窗口中选择 “系统变量” 下的 “新建” 按钮创建环境变量。
变量名:MAVEN_HOME
变量值:D:\Maven\apache-maven-3.8.1(文件路径)
在这里插入图片描述

2.在path环境变量中添加:%MAVEN_HOME%\bin
在这里插入图片描述
3.测试:按住win+R 输入cmd,进入黑窗口控制台。输入命令: mvn -v
如果出现以下maven的版本信息,则说明maven的安装与环境变量的配置均正确;
在这里插入图片描述
四.配置仓库
1.在maven的安装目录下创建一个repository文件夹(一般习惯将仓库地址和maven安装目录放置在一起)。
在这里插入图片描述
2.在D:\Maven\apache-maven-3.8.1\conf下可以找到settings文件
在这里插入图片描述
这个已经配置好的settings文件,在这边需要修改三个地方。

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  • 8
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值