Maven迁移localrepository
1.1 Maven仓库主要有2种:
local repository:存放在本地磁盘的⼀个⽂件夹,例如,windows上默认是C:\Users\{⽤户名}\.m2\repository⽬录
1.2 Remote Repository主要有3种:
私服:内⽹⾃建的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%/l,maven_home可以查看idea中的maven设置
打开l,修改配置信息
<!-- 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>
最后就是把这个l配置⽂件覆盖掉idea中默认的配置
⼀切ok,再把原来C盘中的repository资源迁移到新的位置就可以了。
===================================================================
maven 镜像配置成国内的
同样是在上⾯的l中进⾏配置
<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>my.repository/repo/path</url>
</mirror>
-->
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>maven.oschina/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>/maven2/</url>
</mirror>
<mirror>
<id>net-cn</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>maven/content/groups/public/</url>
如何配置maven环境变量
</mirror>
<mirror>
<id>ui</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>JBossJBPM</id>
<mirrorOf>central</mirrorOf>
<name>JBossJBPM Repository</name>
<url>/nexus/content/repositories/releases/</url>      </mirror>
<mirror>
<id>antelink</id>
<mirrorOf>central</mirrorOf>
<name>antelink Repository</name>
<url>maven.antelink/content/repositories/central/</url>
</mirror>
<mirror>
<id>openkoala</id>
<mirrorOf>central</mirrorOf>
<name>openkoala Repository</name>
<url>/nexus/content/groups/Koala-release/</url>      </mirror>
<mirror>
<id>tmatesoft</id>
<mirrorOf>central</mirrorOf>
<name>tmatesoft Repository</name>
<url>atesoft/content/groups/public/</url>
</mirror>
<mirror>
<id>mavensync</id>
<mirrorOf>central</mirrorOf>
<name>mavensync Repository</name>
<url>/maven2/</url>
</mirror>
</mirrors>
阿⾥云的
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>maven.aliyun/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。