Maven 使用国内镜像

1 修改maven 的配置文件 settings.xml,添加阿里云的一个中央仓库。

2 找到maven 的配置文件,一般在 maven 安装目录 apache-maven-3.5.0\conf 文件夹下

3 修改如下内容

<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>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
    <!-- 中央仓库1 -->
    <mirror>
        <id>repo1</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo1.maven.org/maven2/</url>
    </mirror>
    <!-- 中央仓库2 -->
    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>

  </mirrors>

原文地址:https://www.cnblogs.com/zhaopengcheng/p/9534800.html

时间: 2024-07-30 23:21:31

Maven 使用国内镜像的相关文章

Maven的国内镜像(解决jar下载过慢)

Maven简介 maven作为一个项目管理工具确实非常好用,结果在使用时候,你会发现下载jar速度不如自己在网上下载.之前oschina的中央仓库可用,现在oschina的maven服务器关了,只能拿国内镜像来替代.在网上发现阿里云公开了一个中央仓库,就顺手写下来了,方便以后使用. 修改Maven目录中的conf/settings.xml 找到mirrors节点,添加到节点下 1.这是阿里云仓库 <mirror> <id>alimaven</id> <name&g

maven的国内镜像配置

maven阿里云中央仓库 maven作为一个项目管理工具确实非常好用,但是在国内这个网络条件下实在是让人恼火.之前oschina的中央仓库可用,现在oschina的maven服务器关了,一直没找到国内镜像来替代.今天发现阿里云公开了一个中央仓库,大家可以试试. 配置 修改maven根目录下的conf文件夹中的setting.xml文件,内容如下: <mirrors> <mirror> <id>alimaven</id> <name>aliyun

Maven的国内镜像

OSChina的maven镜像不能用了.网上搜了一下,阿里云的镜像还不错. 在maven的settings.xml里增加 <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Aliyun Mirror</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url&

IntelliJ IDEA设置自带的maven为国内镜像

找到idea中maven中的“settings.xml”位置 一般在idea安装目录下的“D:\Program Files\JetBrains\IntelliJ IDEA\plugins\maven\lib\maven3\conf” 有maven2和maven3选择 打开settings.xml,其中查找“<mirrors>”标签 在“<mirrors>”标签的注释后面 加下面语句: <mirror> <id>aliyun-public</id>

maven,阿里云国内镜像,提高jar包下载速度

镜像 maven默认会从中央仓库下载jar包,这个仓库在国外,而且全世界的人都会从这里下载,所以下载速度肯定是非常慢的.镜像就相当于是中央仓库的一个副本,内容和中央仓库完全一样,目前有不少国内镜像,其中阿里云算是比较稳定的,同时也能保证下载速度 配置方法 在settings.xml 中配置,所有项目都会生效 [html] view plain copy <mirrors> <mirror> <id>alimaven</id> <name>aliy

170220、maven国内镜像 阿里云

maven确实是一个好东西,但是在国内下载官方仓库的jar却是个大问题,速度不敢恭维,现在oschina的国内maven镜像服务已关闭,无奈之下只能另寻门路. 今天突然发现了阿里云maven国内镜像,修改完以后速度飞一般的感觉,超赞,这个激动啊... 修改方法:在~/.m2目录下的settings.xml文件中,(如果该文件不存在,则需要从maven/conf目录下拷贝一份),找到<mirrors>标签,添加如下子标签: <!--阿里云maven国内镜像--> <mirror

gradle配置国内镜像

使用阿里云国内镜像 对单个项目生效,在项目中的build.gradle修改内容 buildscript { repositories { maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'} } dependencies { classpath 'com.android

gradle更换国内镜像、配置本地仓库地址

gradle更换国内镜像,安装包解压后init.d文件夹下面创建init.gradle文件,内容如下 allprojects{ repositories { def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.ur

同步、更新、下载Android Source & SDK from 国内镜像站

转自: 同步.更新.下载Android Source & SDK from 国内镜像站 Download the android source from china mirrors???? 以前都是从Google的站点下载同步更新的,但是现在有了国内的镜像站点就好多了 帮助 ?https://wiki.tuna.tsinghua.edu.cn/MirrorUsage/android ? 仓库地址: git://aosp.tuna.tsinghua.edu.cn/android/ ? 使用浏览器访