maven指定本地仓库和阿里云镜像设置

一、指定本地仓库

  1、本机新建一个文件夹当做本地仓库

    博主的是:D:\learn\java\maven-repository

  2、在maven的conf目录下的在settings.xml中添加localRepository标签

<?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">
  <!-- 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:\learn\java\maven-repository</localRepository>

  

二、阿里云镜像配置

  在settings.xml文件中的mirrors下添加mirror标签

  <mirrors>
     <mirror>
      <id>aliyun-maven</id>
      <mirrorOf>central</mirrorOf>
      <name>aliyun maven mirror</name>
      <url>https://maven.aliyun.com/repository/central</url>
    </mirror>
  </mirrors>

 

posted @ 2021-05-27 00:21  未来可期_Durant  阅读(756)  评论(0编辑  收藏  举报