[英]Could not resolve org.apache.commons:commons-lang3:3.0 peer not authenticated gradle 2.2.1
這是第一次使用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
文件以及建議用戶指南放在我的測試項目中。
我也檢查了這個相關問題,但基本上是我目前正在遵循的步驟。 我還用官方指南中描述的參數確認了參數。
我基本上是按照這個gradle教程
我想念什么嗎? 老實說,我的大腦已經被鎖住了,我沒有主意了:)
提前致謝
鳳凰零
更新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連接?
提前致謝
即使您的調試日志看起來不是這個問題,您是否嘗試添加
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
,因為主要使用“ http”而不是“ https”來訪問Maven存儲庫?
如果您想使“ https”正常工作,則可能是證書問題(如注釋中所述)。 因此,當您在Eclipse中導入Gradle項目以解決該問題時,您可以嘗試遵循未認證的Peer中的答案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.