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

标签 java maven

尝试清理项目时 Maven 抛出超时

USER>mvn clean

在此命令之后,构建抛出:

[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

最佳答案

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

此外,如果您使用本地托管的“代理”maven 存储库,请勿重新配置 central 以指向本地托管的 maven 存储库,而是使用“镜像”指令,将存储库配置为id 类似于“localrepo”的内容,并将其指定为“mirrorOf”central

最后,避免任何“代理”设置,除非您希望所有搜索都开始搜索网络外部(也称为互联网)的存储库。

Maven 以非常具体的方式管理依赖关系,这提供了构建的可重复性。基本上它需要在 pom.xml 中进行编码。是的,你可以使用一些魔法来通过命令行传递这些东西,但如果你这样做,你就违背了 Maven 的设计(同时剥夺了你自己的大部分实用性)。

如果您需要“更新”构建,请考虑制作一个脚本来更新和检查 Artifact 的 pom.xml,或者(不太理想)将依赖项建立在快照版本上。

关于java - 中央存储库上的 Maven 超时 - 无代理设置 - Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34601706/

相关文章:

java - Maven多模块+继承: Issue in building submodules when maintaining parent version number via placeholders

Java RMI 和 NoClassDefFoundError

java - 使用自定义验证根据 XSD 验证 XML

scala - 如何将我的 logback.xml 作为系统属性传递到我的 akka 应用程序中?

java - Netbeans Linux : Mojo failure

java - 如何使用 swagger-jaxrs-doclet 的输出来生成 swagger 文档?

android - Gradle 中的多个 Maven 存储库

java - 有没有我可以使用的 Map 来防止 .equals() 重复?

java - 无状态身份验证是否适用于每用户数据库连接?

java - 使用 Java,如何实例化 GAE 数据存储以便它可以与 GqlQuery 结合使用?