Maven
  1. Maven
  2. MNG-5237

Cannot download maven dependencies through NTLM proxy

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.4
    • Fix Version/s: None
    • Component/s: Dependencies
    • Labels:
      None
    • Environment:
      windows xp64 using cygwin
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      Using proxy in settings.xml, I was able to download maven dependencies in 3.0.3, but this seems to be broken with 3.0.4:

      Proxy definition in settings.xml (hidden ip adress below, but correct proxy ip on my system):

        <proxies>
         <proxy>
            <id>optional</id>
            <active>true</active>
            <protocol>http</protocol>
            <username></username>
            <password></password>
            <host>xxx.xx.xx.xx</host>
            <port>8080</port>
            <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
          </proxy>
        </proxies>

      Output from 3.0.3:

      $ mvn -V clean
      Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
      Maven home: C:\Program Files\apache-maven-3.0.3
      Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
      Java home: C:\Program Files\Java\jdk1.6.0_24\jre
      Default locale: no_NO, platform encoding: Cp1252
      OS name: "windows xp", version: "5.2", arch: "amd64", family: "windows"
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building <xxx hidden xxx>
      [INFO] ------------------------------------------------------------------------
      Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
      Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 4.9 KB/sec)
      ..... and so on...
      
      Output from 3.0.4:
      $ mvn -V clean
      Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
      Maven home: C:\Program Files\apache-maven-3.0.4
      Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
      Java home: C:\Program Files\Java\jdk1.6.0_24\jre
      Default locale: no_NO, platform encoding: Cp1252
      OS name: "windows xp", version: "5.2", arch: "amd64", family: "windows"
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building <xxx hidden xxx>
      [INFO] ------------------------------------------------------------------------
      Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.390s
      [INFO] Finished at: Fri Feb 03 13:14:35 CET 2012
      [INFO] Final Memory: 5M/490M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2): Access denied to: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom, ReasonPhrase:Forbidden. -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [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 read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
      
      

        Activity

        Hide
        Frederic Jecker added a comment -

        @Philip Singer :
        I removed the wagon-httpd-lightweight-2.2 from my lib/ext and tested the provided solution (run with -Djava.net.preferIPv4Stack=true)
        It did not work (could not download artifact: Proxy Authentication Required)

        Show
        Frederic Jecker added a comment - @Philip Singer : I removed the wagon-httpd-lightweight-2.2 from my lib/ext and tested the provided solution (run with -Djava.net.preferIPv4Stack=true) It did not work (could not download artifact: Proxy Authentication Required)
        Hide
        kino lucky added a comment -

        I have encountered the same issue. I use the cntlm proxy that should not need username and password, because the cntlm has already had the username and password.
        But after i have set the username and password in the setting.xml of the maven too, it works well.

        Show
        kino lucky added a comment - I have encountered the same issue. I use the cntlm proxy that should not need username and password, because the cntlm has already had the username and password. But after i have set the username and password in the setting.xml of the maven too, it works well.
        Hide
        Kristian Rosenvold added a comment - - edited

        We just had a fix in Wagon (d6a6c6f6e133365ff6a68d06de3ab1bfc0a0484c) that might resolve this issue also of wagon-http.

        I just started a build on CI and an updated snapshot should be available on https://repository.apache.org/content/groups/snapshots/org/apache/maven/wagon/wagon-http/2.5-SNAPSHOT/ soonish (check timestamp on file!). Copy the http-wagon jar file to the "lib" installation directory of their maven installation (dont forget to remove the old one)

        Show
        Kristian Rosenvold added a comment - - edited We just had a fix in Wagon (d6a6c6f6e133365ff6a68d06de3ab1bfc0a0484c) that might resolve this issue also of wagon-http. I just started a build on CI and an updated snapshot should be available on https://repository.apache.org/content/groups/snapshots/org/apache/maven/wagon/wagon-http/2.5-SNAPSHOT/ soonish (check timestamp on file!). Copy the http-wagon jar file to the "lib" installation directory of their maven installation (dont forget to remove the old one)
        Hide
        Anders Hammar added a comment -

        @Kristian; Unfortunately you can't drop in wagon-http.jar as the Maven bundled one includes shaded classes. What I did to try Wagon 2.6 was to build latest 3.2.0-SNAPSHOT of Maven core (0f48aabf522983f648455dba80c4d97980143495) where I updated the wagon version to 2.6. Trying that shows no success with a NTLM proxy. However, adding wagon-http-lightweight-2.6.jar to lib/ext makes NTLM work with the proxy.

        Show
        Anders Hammar added a comment - @Kristian; Unfortunately you can't drop in wagon-http.jar as the Maven bundled one includes shaded classes. What I did to try Wagon 2.6 was to build latest 3.2.0-SNAPSHOT of Maven core (0f48aabf522983f648455dba80c4d97980143495) where I updated the wagon version to 2.6. Trying that shows no success with a NTLM proxy. However, adding wagon-http-lightweight-2.6.jar to lib/ext makes NTLM work with the proxy.
        Hide
        Anders Hammar added a comment -

        Also tried Wagon 2.5 in core 3.2.0-SNAPSHOT which doesn't work either.

        Show
        Anders Hammar added a comment - Also tried Wagon 2.5 in core 3.2.0-SNAPSHOT which doesn't work either.

          People

          • Assignee:
            Unassigned
            Reporter:
            Niels Mordt-Ostergaard
          • Votes:
            7 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

            • Created:
              Updated: