Maven 依赖项未下载,代理问题? [英] Maven dependencies are not getting downloaded, proxy issues?

查看:106
本文介绍了Maven 依赖项未下载,代理问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前的 WinHTTP 代理设置:在 Windows 机器中直接访问(无代理服务器).并在 settings.xml 中作为 .但是,jars 没有被下载并出现以下错误.

Current WinHTTP proxy settings: Direct access (no proxy server) in windows machine. And in settings.xml as . But, jars are not getting downloaded and getting below error.

[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor fo

r org.apache.maven.plugins:maven-clean-plugin:jar:2.5: 无法从/向中央传输工件 org.apache.maven.plugins:maven-clean-plugin:pom:2.5(https://repo.maven.apache.org/maven2):连接到 repo.maven.apache.org:443 [repo.maven.apache.org/151.101.24.215] 失败:连接超时:connec -> [帮助 1]

r org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.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/151.101.24.215] failed: Connection timed out: con nect -> [Help 1]

推荐答案

根据 Maven 文档,我们必须添加一些 settings.xml 和这里提到的设置 代理指南 .

As per maven documentation we have to add some settings.xml with setting in it mentioned here Guide to proxies .

<settings>
   <proxies>
      <proxy>
        <id>example-proxy</id>
        <active>true</active>
        <protocol>http</protocol>
        <host>proxy.example.com</host>
        <port>8080</port>
        <username>proxyuser</username>
        <password>somepassword</password>
        <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
      </proxy>
   </proxies>
   .
   .
</settings>

另一种快速下载依赖的方法如下

Another way to do download dependencies quickly is as follows

mvn clean install -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=YourPort 

第二个对我来说很好.希望上述解决方案中的至少一种对您有用,希望您的网络没有来自 maven 存储库的任何被阻止的服务器.

the second one works fine for me. Hope atleast one of above solution will work for you hoping your network doesn't have any blocked servers from maven repo.

这篇关于Maven 依赖项未下载,代理问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆