1

This is the first time using Gradle 2.2.1. Unfortunately in my company we have settled up proxy with authentication scheme based on AD credentials. But when I try to make an eclipse project I receive the following error:

Could not resolve all dependencies for configuration compile.     
Could not resolve org.apache.commons commons-lang3 3.0.
Required by:
   GradleTest 2.2.1
Could not GET repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.0/commons-lang3-3.0.pom
peer not authenticated
Could not resolve log4j log4j 1.2.16.
Required by
    GradleTest 2.2.1
Could not GET https://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.pom.
peer not authenticated

I already made a gradle.properties file inside my project with the following configuration:

systemProp.https.proxyHost=(Proxy IP address)
systemProp.https.proxyPort=3128
systemProp.https.proxyUser=(My Username - tried with domain and without domain)
systemProp.https.proxyPassword=(My AD Password)

build.gradle:

apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
archivesBaseName = 'martin'
version = '2.2.1' 
repositories {
    mavenCentral()
}
dependencies {
   compile  'org.apache.commons commons-lang3 3.0'
   compile  'log4j log4j 1.2.16'
} 

I saved this configuration inside the

%userprofile%.gradle\gradle.properties

file and also inside my test project as suggest the user guide.

I also checked this related issue but is basically the steps that I´m currently following. I Also confirmed the parameters with the ones described in the official guide.

I'm basically following this gradle tutorial

Am I missing something? to be honest my brain has been locked out and I´m out of ideas :)

Thanks in advance

Phoenixzero

UPDATE 2014-12-12:

After playing with the log options I can get the following output log:

6:50:03.187 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Authentication required
16:50:03.187 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] (IPAddress):3128 requested authentication
16:50:03.187 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Authentication schemes in the order of preference: [negotiate, Kerberos, NTLM, Digest, Basic]
16:50:03.187 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Challenge for negotiate authentication scheme not available
16:50:03.187 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Challenge for Kerberos authentication scheme not available
16:50:03.187 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Challenge for NTLM authentication scheme not available
16:50:03.187 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Challenge for Digest authentication scheme not available
16:50:03.187 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Selected authentication options: [BASIC]
16:50:03.187 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Connection kept alive
16:50:03.187 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
16:50:03.187 [DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Proxy auth state: CHALLENGED
16:50:03.187 [DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Generating response to an authentication challenge using basic scheme
16:50:03.202 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: CONNECT repo1.maven.org:443 HTTP/1.1
16:50:03.202 [DEBUG] [org.apache.http.headers] >> CONNECT repo1.maven.org:443 HTTP/1.1
16:50:03.202 [DEBUG] [org.apache.http.headers] >> Host: repo1.maven.org
16:50:03.202 [DEBUG] [org.apache.http.headers] >> Proxy-Connection: Keep-Alive
16:50:03.202 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/2.2.1 (Windows 7;6.1;x86) (Oracle Corporation;1.7.0_71;24.71-b01)
16:50:03.202 [DEBUG] [org.apache.http.headers] >> Proxy-Authorization: Basic ***
16:50:03.218 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 Connection established
16:50:03.218 [DEBUG] [org.apache.http.headers] << HTTP/1.1 200 Connection established
16:50:03.218 [DEBUG] [org.apache.http.client.protocol.ResponseProcessCookies] Cookie spec not specified in HTTP context
16:50:03.218 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Authentication succeeded
16:50:03.218 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Caching 'basic' auth scheme for http://(IPAddress):3128
16:50:03.218 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Tunnel to target created.
16:50:03.405 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:5931<->(IPAddress):3128 closed
16:50:03.405 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:5931<->(IPAddress):3128 shut down
16:50:03.405 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:5931<->(IPAddress):3128 closed
16:50:03.405 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection released: [id: 0][route: {tls}->http://(IPAddress):3128->https://repo1.maven.org][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 10]
16:50:03.421 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting dependency :GradleTest:2.2.1(compile) -> log4j:log4j:1.2.16(dependency: log4j#log4j;1.2.16 {compile=[default]})
16:50:03.421 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Selecting new module version log4j:log4j:1.2.16
16:50:03.421 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve log4j:log4j:1.2.16 using repositories [MavenRepo]
16:50:03.421 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver] Loading https://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.pom
16:50:03.421 [DEBUG] [org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor] Constructing external resource: https://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.pom
16:50:03.421 [DEBUG] [org.gradle.internal.resource.transport.http.HttpResourceAccessor] Constructing external resource: https://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.pom
16:50:03.421 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientHelper] Performing HTTP GET: https://repo1.maven.org/maven2/log4j/log4j/1.2.16/log4j-1.2.16.pom
16:50:03.421 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection request: [route: {tls}->http://(IPAddress):3128->https://repo1.maven.org][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 10]
16:50:03.421 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection leased: [id: 1][route: {tls}->http://(IPAddress):3128->https://repo1.maven.org][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 10]
16:50:03.421 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to (IPAddress):3128
16:50:03.421 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Re-using cached 'basic' auth scheme for http://(IPAddress):3128
16:50:03.421 [DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Proxy auth state: CHALLENGED
16:50:03.421 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: CONNECT repo1.maven.org:443 HTTP/1.1
16:50:03.421 [DEBUG] [org.apache.http.headers] >> CONNECT repo1.maven.org:443 HTTP/1.1
16:50:03.421 [DEBUG] [org.apache.http.headers] >> Host: repo1.maven.org
16:50:03.421 [DEBUG] [org.apache.http.headers] >> Proxy-Connection: Keep-Alive
16:50:03.421 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/2.2.1 (Windows 7;6.1;x86) (Oracle Corporation;1.7.0_71;24.71-b01)
16:50:03.421 [DEBUG] [org.apache.http.headers] >> Proxy-Authorization: Basic ***
16:50:03.436 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 200 Connection established
16:50:03.436 [DEBUG] [org.apache.http.headers] << HTTP/1.1 200 Connection established
16:50:03.436 [DEBUG] [org.apache.http.client.protocol.ResponseProcessCookies] Cookie spec not specified in HTTP context
16:50:03.436 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Authentication succeeded
16:50:03.436 [DEBUG] [org.apache.http.impl.client.ProxyAuthenticationStrategy] Caching 'basic' auth scheme for http://(IPAddress):3128
16:50:03.436 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Tunnel to target created.

As far as I´m looking, Gradle is trying to connect to the Proxy server via http, but this is not an HTTP proxy. Am I wrong? How do I set to enable the proxy host but it does not connect using http?

Thanks in advance

Community
  • 1
  • 1
PhoenixzeroX
  • 61
  • 1
  • 9
  • 1
    Do you use the same proxy for internet browsing as well? Can you view sites with the same credentials? Seems like you cant authenticate with your proxy. – Jared Burrows Dec 12 '14 at 22:59
  • @JaredBurrows Thanks for you comments. Yes, if I login in a browser with the same credentials I don´t have issues. Additionally if I enable de --debug option I reveice a lot of Proxy Authentication Required errors. I'm not sure if this errors are because my credentials are wrong or if I'm entering the incorrect credentials. Regards – PhoenixzeroX Dec 12 '14 at 23:07
  • "I also checked this related issue but is basically the steps that I´m currently following." So you did import a certificate into your JDK's certificate store? – Peter Niederwieser Dec 12 '14 at 23:28
  • Hey, I think I have seen something similar. Instead of "systemProp.https.proxyUser" try using "https.proxyUser". Also, see @PeterNiederwieser's comment. – Jared Burrows Dec 12 '14 at 23:38
  • @PeterNiederwieser. Yes. but no luck. Regards and thanks – PhoenixzeroX Dec 12 '14 at 23:55
  • @PhoenixzeroX That's likely the issue though. Perhaps something went wrong there (wrong JDK, wrong certificate, etc.)? – Peter Niederwieser Dec 12 '14 at 23:58
  • @PeterNiederwieser I already upload a snippet of the log file. Does gradle trying to connect as a http authentication proxy? thanks in advance for your help – PhoenixzeroX Dec 13 '14 at 00:06
  • 2
    Doesn't look like a proxy issue to me. (Do you get the same or a different error when you use invalid proxy credentials?) Perhaps try with the latest JDK, which may ship with updated certificates out-of-the-box. If you can, also try with the same machine on a public network that doesn't require a proxy. Also try with a http vs. https repo, e.g. `repositories { maven { url "http://repo1.maven.org/maven2" } }` instead of `repositories { mavenCentral() }`. This should help to narrow it down. – Peter Niederwieser Dec 13 '14 at 00:36
  • @PeterNiederwieser Thank you for your recommendations. Let me try your suggestions and I let you know the updates. I'm using JDK 1.7.0_71 wich is the latest before moving to java 8. Do you think that I need to move to Java 8 instead of using JDK 7? – PhoenixzeroX Dec 13 '14 at 00:47
  • @PeterNiederwieser: After changing the repositories section to `repositories { maven { url "http://repo1.maven.org/maven2" } }` the gradle build processed succesfully. That means that I have proxy issues with HTTP-secure webpages?. Regards – PhoenixzeroX Dec 13 '14 at 00:56
  • 1
    Perhaps, but from a distance I'd say that it's a further indication that this is a certificate issue (not a proxy issue). In any case, it's obviously HTTPS related. – Peter Niederwieser Dec 13 '14 at 01:31
  • @PeterNiederwieser please post as an answer to give you the points. I'll check about it tomorrow morning. Greetings – PhoenixzeroX Dec 13 '14 at 06:53
  • @PhoenixzeroX !!!! WARNING: Change your password immediately as the log above contains all the basic authentication information which can easily reverse engineered (even if I have removed it from the log) ... !!!! – Andreas Schmid Jan 02 '15 at 12:58
  • @AndreasSchmid Thanks for pointing me that. I already changed the password. Regards – PhoenixzeroX Jan 07 '15 at 23:24

1 Answers1

0

Even if your debug log doesn't look like this is the issue, have you tried to add

systemProp.http.proxyHost=(Proxy IP address)
systemProp.http.proxyPort=3128
systemProp.http.proxyUser=(My Username - tried with domain and without domain)
systemProp.http.proxyPassword=(My AD Password)

in your gradle.properties, as the maven repositories are mainly accessed using "http" instead of "https"?

If you want to get "https" working and it could be a certificate problem (as stated in the comments alreday). Therefore you can try to follow the answer in Peer not authenticated while importing Gradle project in eclipse for solving it.

Community
  • 1
  • 1
Andreas Schmid
  • 1,195
  • 8
  • 13