Maven 问题汇总

解决Maven下载依赖慢的问题

解决Maven下载依赖慢的问题,使用Maven构建项目时,项目中有的依赖包可能下载的非常慢,我们可以通过配置镜像来解决这个问题。
在Maven的配置文件(%MAVEN%/conf/setting.xml)中的 标签中加入

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

还有以下常用库:
http://repo1.maven.org/maven2/
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/acegisecurity/

http://repository.jboss.com/maven2/
http://repository.sonatype.org/content/groups/public/

Failed to copy file for artifact

While building project:
Group-Id: xxx
Artifact-Id: xxxx
Version: x.x.x
From file: E:\workspace\xxxx\pom.xml

Reason: Failed to copy file for artifact[xxx:xxxx:jar:x.x.x:compile]

错误原因是:要下载的这个xxx.xxxx.x.x.x.jar这个包,在本地已经有一个xxxx的工程,先将这工程关掉,然后再去mvn war:inplace一下就不会有 问题了。

修改local repository

修改settings.xml文件:

在文件中找到

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
-->

在其后添加内容:

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
 <localRepository>${user.home}/repository/maven</localRepository>

其中:${user.home}/repository/maven是你maven本地仓库的路径。

保存退出。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值