1.1 Maven仓库主要有2种:

  • remote repository:相当于公共的仓库,大家都能访问到,一般可以用URL的形式访问,一般默认的地址:http://search.maven.org/

  • local repository:存放在本地磁盘的一个文件夹,例如,windows上默认是C:\Users\{用户名}\.m2\repository目录

1.2 Remote Repository主要有3种:

  • 中央仓库:http://repo1.maven.org/maven2/

  • 私服:内网自建的maven repository,其URL是一个内部网址

  • 其他公共仓库:其他可以互联网公共访问maven repository,例如 jboss repository等

repository里存放的都是各种jar包和maven插件。当向仓库请求插件或依赖的时候,会先检查local repository,如果local repository有则直接返回,否则会向remote repository请求,并缓存到local repository。

也可以把做的东西放到本地仓库,仅供本地使用;或上传到远程仓库,供大家使用。

================================

我用的是idea自带的maven3

下载安装idea以后,最好先配置一些maven的环境变量,有一些操作要在cmd中进行

idea中的maven路径为:

D:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.3\plugins\maven\lib\maven3

在环境变量中配置

MAVEN_HOME,变量值就是上面的路径

再在Path中添加

%MAVEN_HOME%\bin;

这样maven就配置好了。

maven默认的仓储位置是C:\Users\Administrator\.m2

资源全放系统盘,万一要重装系统呢?现在切换到D盘

打开配置文件,位置为%MAVEN_HOME%/conf/setting.xml,maven_home可以查看idea中的maven设置

打开setting.xml,修改配置信息

  <!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\360CloudUI\maven\repository</localRepository>

最后就是把这个setting.xml配置文件覆盖掉idea中默认的配置

一切ok,再把原来C盘中的repository资源迁移到新的位置就可以了。

===================================================================

maven 镜像配置成国内的

同样是在上面的setting.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>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>net-cn</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://maven.net.cn/content/groups/public/</url>
</mirror>
<mirror>
<id>ui</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror> <mirror>
<id>JBossJBPM</id>
<mirrorOf>central</mirrorOf>
<name>JBossJBPM Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
</mirror>
<mirror>
<id>antelink</id>
<mirrorOf>central</mirrorOf>
<name>antelink Repository</name>
<url>http://maven.antelink.com/content/repositories/central/</url>
</mirror>
<mirror>
<id>openkoala</id>
<mirrorOf>central</mirrorOf>
<name>openkoala Repository</name>
<url>http://nexus.openkoala.org/nexus/content/groups/Koala-release/</url>
</mirror>
<mirror>
<id>tmatesoft</id>
<mirrorOf>central</mirrorOf>
<name>tmatesoft Repository</name>
<url>http://maven.tmatesoft.com/content/groups/public/</url>
</mirror>
<mirror>
<id>mavensync</id>
<mirrorOf>central</mirrorOf>
<name>mavensync Repository</name>
<url>http://mavensync.zkoss.org/maven2/</url>
</mirror>
</mirrors>

阿里云的

  <mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>

http://blog.csdn.net/jiuqiyuliang/article/details/45390313

https://my.oschina.net/fdblog/blog/546938

http://www.tuicool.com/articles/VRJ3qui

http://zhidao.baidu.com/link?url=9M9KLKNfeTU8gqRBA3sCbwD6HkZZ_PpzxaGZJpgBBnTLNf5bddxtnCn3HusnydRDHwlsFMcnm6eDz2ii0ebV_w59Cd-anw-B4KdIGFQnK5q

https://my.oschina.net/sunchp/blog/100634

Maven 迁移local repository的更多相关文章

  1. 将jar文件加到Maven的local repository中

    对于Maven项目来说,日常使用的多数第三方java库文件都可以从Maven的Central Repository中自动下载,但是如果我们需要的jar文件不在Central Repository中,那 ...

  2. 如何设置maven的local repository目录

    step1:默认会放在~/.m2/repository目录下 (“~”代表用户的目录,比如windows下一般都是C:\Documents and Settings\[你的用户名]\.由于“Docum ...

  3. How to include custom library into maven local repository?--转

    原文地址:https://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/ There ...

  4. maven编译项目时提示:cached in the local repository

    今天使用命令mvn compile编译maven项目时提示错误信息,部分错误信息如下: ...... was cached in the local repository, resolution wi ...

  5. 【转】Install Oracle Jdbc driver in your Maven local repository

    Install Oracle Jdbc driver in your Maven local repository If you are using Oracle, you must first in ...

  6. Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from http://repo.maven.apache.org/ maven2 was cached in the local repository, resolution will not be reattempted until the update interv

    Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from http://repo.maven.apache.org/  mave ...

  7. Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval o

    pom.xml报错: Failure to transfer org.apache.maven:maven-archiver:pom:2.5 from https://repo.maven.apach ...

  8. Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempt

    第一次用 Spring Starter Project 创建一个Spring应用时,POM 文件报错: Project build error: Non-resolvable parent POM f ...

  9. Maven 错误 Failure to transfer ...was cached in the local repository...

    Maven 错误 Failure to transfer ...was cached in the local repository... 我解决的时候多了两步才解决 1. mvn clean ins ...

随机推荐

  1. 使用Powershell取出属于某些指定组的用户并导出为csv

    知识这东西就像雪球,越滚越大,今天看到了这篇自己1年多前写的博文,简直弱爆了.于是更新一下程序: 2016-6-15更新,短短几行代码,就拿到了组和组成员,其中还用到了递归,以处理组成员是组的情况: ...

  2. Oracle 10g安装64位图解流程

    1. 安装准备阶段 1.1 安装Oracle环境 本例使用X-Manager来实现与Linux系统的连接,本例使用的所有命令和操作都是在X-Manager下进行.X-Manager安装完成后的配置方法 ...

  3. [Albert 朗读行动记录贴]采纳Scalers方法:口语成长行动

    目标:100小时成长计划,持续朗读录音100小时. 行动计划:每天点评美音3个人的朗读,英音1个. 完成朗读计划,录一段.附录一段.1分半左右. 开始日期:3月18日 原帖: [335][合辑]Sca ...

  4. Open vSwitch使用案例扩展实验

    参考:Open vSwitch使用案例扩展实验 实验目的: 通过python脚本调用OpenvSwitch命令: 学习Mininet基于python脚本创建拓扑的实现: 进一步深度使用"ov ...

  5. [转]SQLBulkCopy使用

    SQLBulkCopy,用于数据库之间大批量的数据传递.通常用于新,旧数据库之间数据的更新.即使表结构完全不同,也可以通过字段间的对应关系,顺利的将数据导过来. 首先,SQLBulkCopy需要2个连 ...

  6. 【转】如何使php的MD5与C#的MD5一致?

    有c#生成MD5的代码如下: class CreateMD5 { static void Main(string[] args) { string source = "提问指南"; ...

  7. js 程序出发事件

    <html> <head><title>Test</title></head> <body> <div id='divTe ...

  8. trunc sysdate

    select *  from per_all_people_f papf where trunc(sysdate) between trunc(papf.effective_start_date) a ...

  9. jsmooth 中文乱码

    为了一个问题 语言国际国际化  测试了这么多回  ,真佩服自己 jsmooth 中文乱码 语言乱码 的解决办法 : 需要在“JVM” 的参数 中填入一项 : user.language=en  而不是 ...

  10. AndEngine

    AndEngine http://www.oschina.net/question/54100_16765