本文介绍了自动生成代理背后的 Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我支持自动生成的代理.

I'm behind a auto-generated proxy.

我已将 settings.xml 配置为使用此代理,但它仍然不起作用.Android SDK 与与我设置的相同的代理.

I've configured my settings.xml to use this proxy, but it still doesn't work. The Android SDK works fine with thesame proxy which I've set.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <proxies>
    <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username></username>
        <password></password>
        <host>MY-PROXY-HOST-HERE</host>
        <port>8080</port>
        <nonProxyHosts></nonProxyHosts>
    </proxy>
  </proxies>
</settings>

我还能做些什么来让 maven 工作?

What else can I do to make maven to work?

错误:

WARNING: NTLM authentication error: Credentials cannot be used for NTLM authenti
cation: org.apache.maven.wagon.providers.http.httpclient.auth.UsernamePasswordCr
edentials

如何获取我的 NTLM 身份验证凭据?

How to get my NTLM authentication credintals?

Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Not authorized by proxy , ReasonPhrase:Proxy Authorization Required.

这是输出消息.在我的 wpad.dat(从我获取代理数据的地方)中,我没有指定的用户名和密码...

This is the output message. In my wpad.dat (from where I've taken proxy data), I don't have a specified username and password...

推荐答案

凭据不是解决方案!

您的问题的解决方案是cntlm

步骤

第一步 -->

永久摆脱这些 NTLM 代理问题的步骤.

  1. 下载并安装cntlm
  2. 编辑 cntlm 安装目录中的 cntlm.ini 文件并确保您的网络有代理,即Proxy NTLMPROXYHOST:PORT";例如代理 192.168.0.1:8080(这是您访问互联网的网络代理!)
  3. 不要忘记将您的 Windows 身份验证凭据放入 cntlm.ini 文件中,只需输入您的 Windows 用户名、域名和密码即可.
  4. 创建名为 CYGWIN 的环境变量(系统变量),值为nodosfilewarning"(不带引号),如果不这样做,您甚至无法启动 cntlm!其次,创建两个名为 http_proxy 的环境变量,其值为http://localhost:3128";和 https_proxy 值为http://localhost:3128".
  5. 转到开始菜单并单击 cntlm 文件夹,然后单击启动 cntlm 身份验证代理"(不要忘记制作启动 cntlm 身份验证代理"快捷方式,否则重新启动后您将无法访问互联网!或每次重新启动时,您都需要手动启动 CNTLM 代理!!).
  6. 打开 Internet Explorer -->工具 -->Internet 选项 -->连接 -->局域网设置
  7. 勾选代理服务器"下的复选框
  8. 在地址"中输入 localhost 或 127.0.0.1文本框并将 3128 放在端口"下文本框(是的!您不再需要网络代理,因为我们已经保存在 cntlm.ini 中).
  9. 点击确定,然后再次确定,然后关闭 IE.
  1. download and install cntlm
  2. edit cntlm.ini file in cntlm installation directory and make sure there is proxy of your network i.e. "Proxy NTLMPROXYHOST:PORT" e.g. Proxy 192.168.0.1:8080 (this is your network proxy from which you access internet!)
  3. DO NOT FORGET TO PUT your windows authentication credentials in cntlm.ini file just put your windows username ,your domain name ,your password .
  4. create environment variable(system variable) named CYGWIN with value "nodosfilewarning"(without quotes) if you don't do so you are not able to even start cntlm! Secondly make two environment variables named http_proxy with value "http://localhost:3128" and https_proxy with value "http://localhost:3128".
  5. go to start menu and click on cntlm folder then click on "start cntlm authentication proxy"(DO NOT FORGET TO MAKE "start cntlm authentication proxy" SHORTCUT A STARTUP PROGRAM OTHERWISE YOU CAN NOT ACCESS INTERNET AFTER REBOOT!! OR YOU NEED TO MANNUALLY START CNTLM PROXY EVERY TIME YOU REBOOT!!).
  6. open internet explorer --> Tools --> Internet Options --> Connections --> LAN settings
  7. tick mark both the checkbox under "proxy server" heading.
  8. put localhost or 127.0.0.1 in "address" text box and put 3128 under "port" text box(yes! you do not need your network proxy anymore as we already kept in cntlm.ini).
  9. click ok then again ok then close IE.

就是这样!!现在你永远不会看到与 NTLM 代理身份验证失败相关的错误,或者任何其他甚至在 sbt 或 maven 中都没有的错误!!!CNTLM 非常快,因为它是用 C 语言开发的!!

Thats it!! now you never see error related to NTLM proxy authentication failed or anything else not even in sbt or maven!!! CNTLM is quite fast as it is developed in C !!

第二步 -->

启动cntlm认证代理服务器

start cntlm authentication proxy server

确保您的 settings.xml 文件的代理看起来像这样.

make sure your settings.xml file's proxy look like this.

  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |-->
    <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>3128</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>

如果有问题,请给我反馈!

Plese give me feedback if something does not work!

这篇关于自动生成代理背后的 Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 05:39