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. MATLAB的使用总结

    Log scale %# some random data x = .^(:); y = rand(size(x)); plot(log2(x), y) %# plot on log2 x-scale ...

  2. LiveUpdate Adminstrator配置手册

    第一种模式: LUA 从Symantec官网LiveUpdate服务器下载更新. .登陆LUA控制台 图1 .添加Symantec Endpoint Protecton v11.0 图2 3. 查看源 ...

  3. 更新AD对象属性值

    1. 对于Set-ADUser不包含的对象属性,可以采用replace来操作 Set-ADUser -Identity 'UserA' -Replace @{userWorkstations = 'C ...

  4. 小组项目beta发布的评价

    这次最看好飞天小女警组,相比上次他们的界面漂亮了很多,功能也相对完善,他们的礼物挑选系统非常有创意.如果去网上爬更多的数据,这个项目会更完美. 新蜂团队的俄罗斯方块游戏新增加了显示下一个方块以及游戏积 ...

  5. metasploit--exploit模块信息

    Name                                             Disclosure Date  Rank    Description ----           ...

  6. scapy 安装及简单测试

    关于scapy Scapy的是一个强大的交互式数据包处理程序(使用python编写).它能够伪造或者解码大量的网络协议数据包,能够发送.捕捉.匹配请求和回复包等等.它可以很容易地处理一些典型操作,比如 ...

  7. page show

    controller public function record() { $r = ; $m = M(); $query = $m->query('select count(1) as cou ...

  8. Tomcat7 安装StartSSL证书笔记

    1.Tomcat-Native安装 使用StartSSL,Tomcat必须用apr方式启动(apr方式对于静态的内容,比默认的bio效率要高很多倍) Windows下tomcat-native安装 直 ...

  9. [Virtualization][SDN] VXLAN到底是什么 [转]

    写在转发之前: 几个月以前,在北大机房和燕园大厦直接拉了一根光钎.两端彼此为校园内公网IP.为了方便连接彼此机房,我做个一个VPN server在燕园的边界,北大机房使用client拨回.两个物理机房 ...

  10. python 十进制 十六进制

    把十六进制的字串转为十进制数字:>>> print int('ff', 16)   255 把十进制数字转换为以十六进制表示之字串,可调用内置的hex()函数:>>> ...