Maven
  1. Maven
  2. MNG-5237

Cannot download maven dependencies through NTLM proxy

    Details

    • Type: Bug Bug
    • Status: 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

      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
        Joerg Schaible added a comment -

        Take a closer look at the URLs. Maven central has been moved and M304 default settings use the new location directly. Possibly you have to update your firewall rules.

        Show
        Joerg Schaible added a comment - Take a closer look at the URLs. Maven central has been moved and M304 default settings use the new location directly. Possibly you have to update your firewall rules.
        Hide
        Niels Mordt-Ostergaard added a comment -

        Not sure that I follow you. Which URL's should I check?

        Also, if I run without the proxy server (which I can, but need to set up with proxy server on another server) it works just fine.

        Is there some kind of re-directing to the new Maven central?

        Show
        Niels Mordt-Ostergaard added a comment - Not sure that I follow you. Which URL's should I check? Also, if I run without the proxy server (which I can, but need to set up with proxy server on another server) it works just fine. Is there some kind of re-directing to the new Maven central?
        Hide
        Niels Mordt-Ostergaard added a comment -

        I spotted the change in the URLs now, sorry. Will check firewall settings.

        Show
        Niels Mordt-Ostergaard added a comment - I spotted the change in the URLs now, sorry. Will check firewall settings.
        Hide
        Babak Vahdat added a comment - - edited

        Being behind a HTTP Proxy I'm suffering from the same behavior (upgrading Maven 3.0.3 => 3.0.4)

        I followed the new 1.1.0 schema (http://maven.apache.org/xsd/settings-1.1.0.xsd) however with no success.

        And actually the Proxy I'm behind of does not require my personal credentials at all (username/password) but just checks only the IP of the box I'm connecting from, that's all! That was also why I didn't have to provide correct username/password while using 3.0.3. However now even using correct credentials under 3.0.4 it blows up with:

        Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:jar:1.0
                at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
                at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
                at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
                at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
                ... 25 more
        Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0 from/to smx.repo (http://svn.apache.org/repos/asf/servicemix/m2-repo/): Not authorized by proxy, ReasonPhrase:Proxy Authentication Required.
                at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
                at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
                at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
                at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
                ... 28 more
        Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0 from/to smx.repo (http://svn.apache.org/repos/asf/servicemix/m2-repo/): Not authorized by proxy, ReasonPhrase:Proxy Authentication Required.
                at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951)
                at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941)
                at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669)
                at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                at java.lang.Thread.run(Thread.java:662)
        Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized by proxy, ReasonPhrase:Proxy Authentication Required.
                at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:843)
                at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
                at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
                at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
                at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
                ... 4 more
        

        To prove that using the same box I can successfuly access the Internet, following couple of lines of code which does deliver me the content of http://www.google.ch

            public static void main(String[] args) throws Exception {
                InetSocketAddress address = new InetSocketAddress("proxy.domain.name", proxy.port.number);
                Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
                URL url = new URL("http://www.google.ch");
                URLConnection connection = url.openConnection(proxy);
                InputStream is = connection.getInputStream();
        
                int c;
                while ((c = is.read()) != -1) {
                    System.out.print((char) c);
                }
            }
        
        Show
        Babak Vahdat added a comment - - edited Being behind a HTTP Proxy I'm suffering from the same behavior (upgrading Maven 3.0.3 => 3.0.4) I followed the new 1.1.0 schema ( http://maven.apache.org/xsd/settings-1.1.0.xsd ) however with no success. And actually the Proxy I'm behind of does not require my personal credentials at all (username/password) but just checks only the IP of the box I'm connecting from, that's all! That was also why I didn't have to provide correct username/password while using 3.0.3. However now even using correct credentials under 3.0.4 it blows up with: Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:jar:1.0 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186) at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412) at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240) ... 25 more Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0 from/to smx.repo (http: //svn.apache.org/repos/asf/servicemix/m2-repo/): Not authorized by proxy, ReasonPhrase:Proxy Authentication Required. at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216) at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281) ... 28 more Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0 from/to smx.repo (http: //svn.apache.org/repos/asf/servicemix/m2-repo/): Not authorized by proxy, ReasonPhrase:Proxy Authentication Required. at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:951) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:941) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:669) at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang. Thread .run( Thread .java:662) Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized by proxy, ReasonPhrase:Proxy Authentication Required. at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:843) at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116) at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601) ... 4 more To prove that using the same box I can successfuly access the Internet, following couple of lines of code which does deliver me the content of http://www.google.ch public static void main( String [] args) throws Exception { InetSocketAddress address = new InetSocketAddress( "proxy.domain.name" , proxy.port.number); Proxy proxy = new Proxy(Proxy.Type.HTTP, address); URL url = new URL( "http: //www.google.ch" ); URLConnection connection = url.openConnection(proxy); InputStream is = connection.getInputStream(); int c; while ((c = is.read()) != -1) { System .out.print(( char ) c); } }
        Hide
        Terence Mill added a comment -

        We are using Windows XP and also configured proxy in settings.xml on Maven 3.04.
        It look likes Maven is not using the proxy settings from M2-Home/conf/settings.xml but the one from windows (Internet explorer). If its configured in ie it works, if not then not. If i configure the same in maven settings.xml it does make any difference.
        For notice: In oor case the m2 server (nexus mirror) is in noproxy string of our enterprise proxy config.

        We get some kind of socks connection error.

        Show
        Terence Mill added a comment - We are using Windows XP and also configured proxy in settings.xml on Maven 3.04. It look likes Maven is not using the proxy settings from M2-Home/conf/settings.xml but the one from windows (Internet explorer). If its configured in ie it works, if not then not. If i configure the same in maven settings.xml it does make any difference. For notice: In oor case the m2 server (nexus mirror) is in noproxy string of our enterprise proxy config. We get some kind of socks connection error.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -
        Show
        Olivier Lamy (*$^¨%`£) added a comment - are you using NTLM proxy ? If yes add the jar http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar to your $M2_HOME/lib/ext
        Hide
        Babak Vahdat added a comment - - edited

        @Olivier
        You made my day, as your recommendation did the trick!
        Thanks for your help

        Show
        Babak Vahdat added a comment - - edited @Olivier You made my day, as your recommendation did the trick! Thanks for your help
        Hide
        Terence Mill added a comment -

        Yes, actually we use NTLM proxy!

        Please fix this!

        Show
        Terence Mill added a comment - Yes, actually we use NTLM proxy! Please fix this!
        Hide
        Dominik Richner added a comment -

        will this get fixed with the next version? (when will that be?)

        Show
        Dominik Richner added a comment - will this get fixed with the next version? (when will that be?)
        Hide
        zart colwing added a comment -

        in response to Olivier Lamy:
        Instead of adding a jar into your Maven installation you can put the following extension into your pom.xml
        <build>
        <extensions>
        <extension>
        <!-- this extension is required by wagon in order to pass the proxy -->
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-http-lightweight</artifactId>
        <version>2.2</version>
        </extension>
        </extensions>
        </build>

        Show
        zart colwing added a comment - in response to Olivier Lamy: Instead of adding a jar into your Maven installation you can put the following extension into your pom.xml <build> <extensions> <extension> <!-- this extension is required by wagon in order to pass the proxy --> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-http-lightweight</artifactId> <version>2.2</version> </extension> </extensions> </build>
        Hide
        Frederic Jecker added a comment -

        Hello,

        Encountered the same issue switching from 3.0.3 to 3.0.4 (Win7/No cygwin)
        The solution proposed by Olivier Lamy fixed the problem

        Show
        Frederic Jecker added a comment - Hello, Encountered the same issue switching from 3.0.3 to 3.0.4 (Win7/No cygwin) The solution proposed by Olivier Lamy fixed the problem
        Hide
        Phillip Singer added a comment -

        I just ran across this thread: http://mail-archives.apache.org/mod_mbox/maven-users/201208.mbox/%3C501CE4E9.5000104@pp6.inet.fi%3E

        Might that be your issue instead?

        Show
        Phillip Singer added a comment - I just ran across this thread: http://mail-archives.apache.org/mod_mbox/maven-users/201208.mbox/%3C501CE4E9.5000104@pp6.inet.fi%3E Might that be your issue instead?
        Hide
        Anders Hammar added a comment -

        Should "proxy" in this ticket's summary be changed to "NTLM proxy"?

        Show
        Anders Hammar added a comment - Should "proxy" in this ticket's summary be changed to "NTLM proxy"?
        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:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

            • Created:
              Updated:

              Development