中央存储库上的Maven超时 - 无代理设置 - Windows

时间:2016-01-04 23:24:14

标签: java maven

Maven在尝试清理项目时会超时

USER>mvn clean

在此命令之后构建throw:

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dep
endencies could not be resolved: Failed to read artifact descriptor for org.apac
he.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apa
che.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven
.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org
/23.235.46.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException

1 个答案:

答案 0 :(得分:1)

您是否在$ {HOME} /.m2 / settings.xml(或pom.xml)中配置了其他存储库?如果是这样,请确保它们都没有central的ID,或者您可能已经重新配置了maven-central的位置。

此外,如果您使用本地托管的"代理" maven存储库,不要重新配置central指向本地托管的maven存储库,而是使用"镜像"指令,将存储库配置为id为" localrepo"并将其指定为" mirrorOf" central

最后,避免任何"代理"设置,除非您希望所有搜索开始在网络之外搜索存储库(也就是在互联网上)。

Maven以非常具体的方式管理依赖项,这提供了构建的可重复性。基本上它需要在pom.xml中编码。是的,你可以通过使用命令行做一些魔术来传递这些东西,但是如果你这样做,你就是在反对maven的设计(并且同时抢夺了大部分的实用程序)。

如果您需要更新"更新"一个构建,考虑制作一个脚本来更新和检查pom.xml中的工件,或者(不太理想)基于对快照版本的依赖。