java - 无法解析org.apache.commons:commons-lang3:3.0对等方未通过身份验证的gradle 2.2.1

标签 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
我想念什么吗?老实说,我的大脑已经被锁住了,我没有主意了:)
提前致谢
凤凰零
更新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”正常工作,则可能是证书问题(如注释中所述)。因此,您可以尝试按照Peer not authenticated while importing Gradle project in eclipse中的答案进行解决。

关于java - 无法解析org.apache.commons:commons-lang3:3.0对等方未通过身份验证的gradle 2.2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27453400/

相关文章:

java - (如何设置)/(看不到)Libgdx 文本字段上的光标?

java - 使用 Java 在笔记本电脑之间进行基于 MAC 的通信

java - 在编译Eclipse期间跳过一些文件

java - 在 eclipse 中安装了深色主题,但滚动条仍然是灰色的

java - 线程 "main"java.lang.NoClassDefFoundError : org/apache/commons/csv/CSVFormat 中出现异常

java - 从 java 类调用 servlet

java - Java 中使用哪种队列实现?

c++ - Eclipse CDT+Cygwin如何处理?

java - Android库插件的Gradle发布错误

Android studio 将 hprof 文件转储到项目文件夹中