WIN系统配置Maven环境结合IDEA部署项目

一、下载安装配置Maven环境

1、前往https://maven.apache.org/download.cgi下载最新版的Maven程序解压位置按个人习惯、尽量不要太难找不要有空格

2、Maven环境变量配置

新建环境变量MAVEN_HOME 赋值刚才解压的根目录
编辑环境变量Path,追加%MAVEN_HOME%\bin; 

3、至此Maven已经完成了安装,可以通过DOS命令检查一下我们是否安装成功输入:mvn -v输出以下内容即可

C:\Users\MrYu>mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.8.0_191
Java home: D:\Program Files\2019 JavaSE\JDK1.8.0_191\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10" version: "10.0" arch: "amd64" Family: "dos"

二、配置本地仓库

1、进入Maven_Home新建一个Repository的文件夹用作maven的本地库、打开maven\conf\settings.xml文件加localRepository配置

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
<localRepository>D:/Program Files/2020_Maven/repo</localRepository>

2、DOS命令输入:mvn help:system在MavenRepository文件夹中会出现新文件

3、接着添加Maven的依赖下载镜像,修改%MAVEN_HOME%\conf\settings.xml文件配置

  <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>https://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

三、IDEA修改Maven插件配置

打开IDEA,在File->OtherSettings->DefaultSettings->Build, Execute, Deployment->Build Tools->Maven

修改 Maven home directory: %MAVEN_HOME%
修改 User settings file: %MAVEN_HOME%\conf\settings.xml (如果不能选择,需要选择override对勾)

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值