无法解析org.apache.commons:commons-lang3:3.0 peer not authenticated gradle 2.2.1

时间:2014-12-12 22:55:21

标签: java eclipse gradle build.gradle

这是第一次使用Gradle 2.2.1。不幸的是,在我的公司,我们已经基于AD凭证确定了具有认证方案的代理。但是当我尝试制作一个eclipse项目时,我收到以下错误:

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

我已经在项目中使用以下配置创建了 gradle.properties 文件:

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'
} 

我将此配置保存在

  

%USERPROFILE%.gradle \ gradle.properties

文件以及我的测试项目中的建议the user guide

我还检查了这个related issue,但基本上是我目前正在遵循的步骤。我还使用official guide中描述的参数确认了参数。

我基本上关注this gradle tutorial

我错过了什么吗?说实话,我的大脑已被锁定,我的想法不存在:)

提前致谢

Phoenixzero

更新2014-12-12:

使用日志选项后,我可以获得以下输出日志:

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.

据我所知,Gradle尝试通过http连接到代理服务器,但这不是HTTP代理。我错了吗?如何设置启用代理主机但不使用http?

进行连接

提前致谢

1 个答案:

答案 0 :(得分:0)

即使您的调试日志看起来不是问题,您是否尝试添加

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)

在您的gradle.properties中,因为maven存储库主要使用“http”而不是“https”进行访问?

如果您希望“https”正常工作,则可能是证书问题(如评论中所述)。因此,您可以尝试按照Peer not authenticated while importing Gradle project in eclipse中的答案来解决问题。