本文介绍了自动生成代理背后的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(这是您用来访问Internet的网络代理!)
  3. 不要忘记在cntlm.ini文件中输入Windows身份验证凭据,只需将Windows用户名,域名,密码输入即可.
  4. 如果不这样做,请创建一个名为CYGWIN的环境变量(系统变量),其值为"nodosfilewarning"(不带引号),因此您甚至无法启动cntlm!其次,创建两个名为http_proxy的环境变量,其值分别为"http://localhost:3128"和https_proxy,其值分别为"http://localhost:3128".
  5. 转到开始菜单,然后单击cntlm文件夹,然后单击启动cntlm身份验证代理"(不要忘记制作启动cntlm身份验证代理".否则,请选择启动程序,否则您无法在重新启动后访问Internet !!每次重新启动时都要手动启动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