Unable to connect maven repo by using proxy


(Nidhin Benjamin) #1

Hi All,

I am unable to connect maven repo by using proxy setting

I have added maven dependency in my build file repositories {

mavenCentral() }

dependencies {

compile group: ‘commons-collections’, name: ‘commons-collections’, version: ‘3.2’

testCompile group: ‘junit’, name: ‘junit’, version: ‘4.+’ }

and also added proxy configuration in the gradle.properties systemProp.proxySet=true systemProp.http.proxyHost=myproxy.com systemProp.http.proxyPort=80 systemProp.http.proxyUser=myusername systemProp.http.proxyPassword=myuserpass

when i run the build i am getting the following error Proxy authentication error: Invalid name provided (Mechanism level: Could not lo ad configuration file C:\WINDOWS\krb5.ini (The system cannot find the file speci fied)) Proxy authentication error: Invalid name provided (Mechanism level: Could not lo ad configuration file C:\WINDOWS\krb5.ini (The system cannot find the file speci fied)) Proxy authentication error: Invalid name provided (Mechanism level: Could not lo ad configuration file C:\WINDOWS\krb5.ini (The system cannot find the file speci fied))

FAILURE: Build failed with an exception.

  • What went wrong: Could not resolve all dependencies for configuration ‘:testRuntime’. > Could not resolve group:commons-collections, module:commons-collections, versi on:3.2.

Required by:

com.winter:sample:0.0.1-SNAPSHOT

Could not GET ‘http://repo1.maven.org/maven2/commons-collections/commons-co llections/3.2/commons-collections-3.2.pom’. Received status code 407 from server : Proxy Authentication Required > Could not resolve group:junit, module:junit, version:4.+.

Required by:

com.winter:sample:0.0.1-SNAPSHOT

Could not GET 'http://repo1.maven.org/maven2/junit/junit/maven-metadata.xml '. Received status code 407 from server: Proxy Authentication Required

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

(Peter Niederwieser) #2

Sounds like http://stackoverflow.com/questions/5746545/apache-httpclient-4-1-1-ntlm-authentication-not-spnego. Apache HTTPClient is what Gradle uses underneath. Have you tried with the latest Gradle version (1.0-milestone-9)? There have recently been some related changes.


(Nidhin Benjamin) #3

I am using Gradle 1.0-milestone-9 for this

------------------------------------------------------------ Gradle 1.0-milestone-9 ------------------------------------------------------------

Gradle build time: Tuesday, March 13, 2012 4:10:09 PM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_23 (Sun Microsystems Inc. 19.0-b09) OS: Windows XP 5.1 x86


(Nidhin Benjamin) #4

Is there any work around for this?


(Peter Niederwieser) #5

One thing worth trying is to replace lib\plugins\httpclient-4.1.2.jar and httpcore-4.1.2.jar in the Gradle distribution with the Jars extracted from http://www.reverse.net/pub/apache//httpcomponents/httpclient/binary/httpcomponents-client-4.2-beta1-bin.zip. Make sure to rename the new Jars to the old filenames. If that doesn’t help, we’ll need to do a deeper investigation, which might take a while.


(vincent wiencek) #6

magical. Thank you. The proxy settings stopped working from gradle milestone 5 …!!!


(Peter Niederwieser) #7

For many users, proxy settings work fine. I haven’t heard of this problem before. We needed to update the HttpClient library to get around other problems. Judging from your feedback, the next update (once HttpClient 4.2 has been released) will solve your problem. Thanks for letting us know.


(Marc Baumgartner) #8

I had the same Issue. With the 4.2 jars it works.

Maybe this can be a reason related to this http://hc.apache.org/httpcomponents-client-ga/ntlm.html

That would explain why it is working for some users and for some not…


(m m) #9

It does not work even after replacing httpclient jars


(David Rodriguez) #10

Move those directives to gradle.properties


(Shawn Vader) #11

I have the same issue with gradle 1.3 which is using httpclient-4.2.1.jar and httpcore-4.2.1.jar


(Andy Bailey) #12

I have just tried the fix suggested above, replace httpclient-4.2.1.jar and httpcore-4.2.1.jar with their 4.2.3.jar equivalents (remembering to rename them with the 4.2.1.jar suffix) and the problem I was experiencing with this was resolved. I also removed the gradle.properties file as this is no longer needed, I assume because Gradle then uses the system proxy settings.

This was for GRADLE-1.3