【问题标题】:mave 3.2 not able to access local nexus instance return 502 codemave 3.2 无法访问本地 nexus 实例返回 502 代码
【发布时间】:2014-09-05 04:52:57
【问题描述】:

访问本地主机中的本地nexus存储库时,返回码为502。

pom.xml 看起来像这样

<repositories>
   <repository>
      <id>nexus</id>
      <name>nexusPublic</name>
      <url>http://localhost:8081/nexus/content/groups/public/</url>
   </repository>
</repositories>

【问题讨论】:

  • 这个问题不是 Maven 中的问题,而是您的网络中的问题。 502 Bad Gateway The server was acting as a gateway or proxy and received an invalid response from the upstream server. 我假设你的机器不允许这样的连接,或者没有启动 nexus 或其他什么。
  • 我可以从浏览器访问相同的网址。
  • 这不是一个论点,因为浏览器与 Maven 不同。 Maven 在 settings.xml 文件中有它的设置,您应该在其中配置代理或其他任何东西......我不知道您是否在代理后面或如何配置您的机器。

标签: maven nexus


【解决方案1】:

致 OP 和任何可能通过谷歌来到这里的人(就像我一样):

我遇到了同样的问题,我输入的项目使用了我们服务器上存储库中的一些工件(通过 Archiva)。我能够从浏览器访问 jar,但 Maven 无法找到它。

问题是我的公司使用代理,无法通过自己的代理连接到公司的服务器。我在我的 Maven 配置 (.m2/settings.xml) 中添加了 &lt;nonProxyHosts&gt;servername.dev.company.com&lt;/nonProxyHosts&gt;。 根据this answer,你的情况是&lt;nonProxyHosts&gt;*localhost*&lt;/nonProxyHosts&gt;。

【讨论】:

    【解决方案2】:

    问题已经回答了,让我写完整的xml配置文件:

    .m2/settings.xml

    <settings>
      <proxies>
        <proxy>
          <id>proxy_http</id>
          <active>true</active>
          <protocol>http</protocol>
          <host>proxy host</host>
          <port>porxy port</port>
          <nonProxyHosts>local.net|host_1|host_2|host_3</nonProxyHosts>
        </proxy>
      </proxies>
    </settings>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-08-07
      • 1970-01-01
      • 2020-03-18
      • 2017-04-29
      • 1970-01-01
      • 2019-07-12
      • 1970-01-01
      相关资源
      最近更新 更多