Intellij IDEA配置Maven(内置Maven和修改本地仓库地址和阿里云中央仓库)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32483145/article/details/81562437

一. 更改说明

1.Intellij IDEA是有自己的Maven插件的,我们只需要配置一下就可以

2.默认仓库位置为C:\Users\账户.m2\repository,如果不更改仓库就会占用C盘空间,反正我的使用没多久仓库就是几个G大小了。

二. 配置说明
1.File->Settings,搜索maven,就可以看到如下界面:注意配置文件的位置和后面两个Override打√(仓库地址自己新建一个空白文件夹就行了)
maven

2.将settings.xml的内容更改如下就大功告成了!

<?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">

  <!--本地仓库目录,注意此处目录应该与上面的设置Local Repository一致-->
  <localRepository>H:/maven/repository</localRepository>
    <mirrors>
      <mirror>
        <!--该镜像的id-->
        <id>nexus-aliyun</id>
        <!--该镜像用来取代的远程仓库,central是中央仓库的id-->
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <!--该镜像的仓库地址,这里是用的阿里的仓库-->
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
      </mirror>
    </mirrors>
</settings>

猜你喜欢

转载自blog.csdn.net/qq_32483145/article/details/81562437