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. 一个关于el中获取对象属性的错误

    具体过程描述为: 在JSP页面中通过<%%>定义一个非public类.并定义两个属性相应的get和set方法.在该代码段中实例化该对象,并将该对象放入Request域中. 然后在页面中使用 ...

  2. html5:服务器事件推送(server-sent events)Asp.net

    支持 不支持IE 个人理解说明 个人理解:这种消息推送方式不太推广,原因有以下三点~~~`我怎么老是学这些自己认为不会推广的东西呢~汗 在.net中,framework4.5以上就可以由SignalR ...

  3. php处理数组函数大全

    PHP:指示支持该函数的最早的 PHP 版本. 函数 描述 PHP array() 创建数组. 3 array_change_key_case() 返回其键均为大写或小写的数组. 4 array_ch ...

  4. 在archlinux上搭建twitter storm cluster

    本文详细描述如何在archlinux上搭建twitter storm cluster,转载请注明出处,谢谢. 有关archlinux基本系统安装,请参照archlinux简明安装指南一文,下面以上述为 ...

  5. PHP防止用户重复提交表单

    我们提交表单的时候,不能忽视的一个限制是防止用户重复提交表单,因为有可能用户连续点击了提交按钮或者是攻击者恶意提交数据,那么我们在提交数据后的处理如修改或添加数据到数据库时就会惹上麻烦. 那么如何规避 ...

  6. Android 通过网页打开自己的APP(scheme)

    Android 通过网页打开自己的APP(scheme) 分类: android2014-07-09 17:35 8565人阅读 评论(2) 收藏 举报 通过用手机的浏览器(内置,第三方都可)访问一个 ...

  7. 总结的一些PHP开发中的tips

    总结的一些PHP开发中的tips 发布时间:2013-05-28 12:47:44   来源:   评论:0 点击: 次 [字号:大 中 小] QQ空间新浪微博腾讯微博人人网豆瓣网百度空间百度搜藏开心 ...

  8. 20145317彭垚《Java程序设计》实验二

    20145317<Java程序设计>实验二Java面向对象程序设计实验报告 实验内容 初步掌握单元测试和TDD 理解并掌握面向对象三要素:封装.继承.多态 初步掌握UML建模 熟悉S.O. ...

  9. javaWeb总结——session

    一.session简单介绍 在web开发中,服务器为每个用户浏览器创建一个会话对象,即session对象.一个浏览器独占一个session对象.因此,在需要保护用户数据时,服务器程序可以把用户数据写到 ...

  10. Connection Management and Security

    High Performance My SQL  THIRD EDITION Each client connection gets its own thread within the server ...