gpt4 book ai didi

gradle - Gradle从1.12升级到2.4后无法解决依赖关系

转载 作者:行者123 更新时间:2023-12-03 04:04:14 25 4
gpt4 key购买 nike

在Win7上将gradle从1.12升级到2.4之后,在gradle项目中无法再解决依赖关系。
实际上,在同一终端(Windows中的bash终端)中,此操作成功完成:

$ /c/Program\ Files\ \(x86\)/gradle-1.12/bin/gradle dependencies
:dependencies

------------------------------------------------------------
Root project - MyProject
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
Download http://repo1.maven.org/maven2/com/sun/mail/mailapi/1.5.4/mailapi-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/all/1.5.4/all-1.5.4.pom
Download http://repo1.maven.org/maven2/net/java/jvnet-parent/1/jvnet-parent-1.pom
Download http://repo1.maven.org/maven2/com/sun/mail/smtp/1.5.4/smtp-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/parent-distrib/1.5.4/parent-distrib-1.5.4.pom
Download http://repo1.maven.org/maven2/com/sun/mail/dsn/1.5.4/dsn-1.5.4.pom
Download http://repo1.maven.org/maven2/com/google/code/gson/gson/2.3/gson-2.3.pom
Download http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.3/log4j-core-2.3.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j/2.3/log4j-2.3.pom
Download http://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download http://repo1.maven.org/maven2/javax/activation/activation/1.1/activation-1.1.pom
Download http://repo1.maven.org/maven2/com/sun/mail/javax.mail/1.5.4/javax.mail-1.5.4.pom
Download http://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.3/log4j-api-2.3.pom
+--- :Support:
+--- com.sun.mail:mailapi:1.5.4
| \--- javax.activation:activation:1.1
+--- com.sun.mail:smtp:1.5.4
| \--- javax.activation:activation:1.1
+--- com.sun.mail:dsn:1.5.4
| +--- com.sun.mail:javax.mail:1.5.4
| | \--- javax.activation:activation:1.1
| \--- javax.activation:activation:1.1
+--- com.google.code.gson:gson:2.3
\--- org.apache.logging.log4j:log4j-core:2.3
\--- org.apache.logging.log4j:log4j-api:2.3
...

但这失败了:
$ /c/Program\ Files\ \(x86\)/gradle-2.4/bin/gradle dependencies
:dependencies

------------------------------------------------------------
Root project - MyProject
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
+--- :Support:
+--- com.sun.mail:mailapi:1.5.4 FAILED
+--- com.sun.mail:smtp:1.5.4 FAILED
+--- com.sun.mail:dsn:1.5.4 FAILED
+--- com.google.code.gson:gson:2.3 FAILED
\--- org.apache.logging.log4j:log4j-core:2.3 FAILED
...

我已经尝试过了:
-将Maven从3.1.1升级到3.3.3
-更新了路径以访问新的gradle-2.4和maven-3.3.3
-重新打开Windows session
-杀死了gradle守护进程
-删除〜/ .gradle / caches
-删除〜/ .gradle并用相同的gradle.properties重新创建一个空的
-删除〜/ .m2 /存储库
-检查了本地cntlm代理配置(等级1.12可以很好地访问它)
-尝试使用参数“ -Dhttp_proxyHost=127.0.0.1 -Dhttp_proxyPort=3128 -Dhttps_proxyHost=127.0.0.1 -Dhttps_proxyPort=3129

感谢您的任何建议。

gradle.build的内容:
apply plugin: 'java'
apply plugin: 'maven'

group = 'my.project'
version = '0.0.1-SNAPSHOT'
description = "MyProject"

sourceCompatibility = 1.7
targetCompatibility = 1.7

//
// dependencies
//
repositories {
mavenCentral()
flatDir { dirs 'ext' }
}
dependencies {
compile name : 'Support'
compile group: 'com.sun.mail' , name: 'mailapi' , version:'1.5.4'
compile group: 'com.sun.mail' , name: 'smtp' , version:'1.5.4'
compile group: 'com.sun.mail' , name: 'dsn' , version:'1.5.4'
compile group: 'com.google.code.gson' , name: 'gson' , version:'2.3'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version:'2.3'

testCompile group: 'org.easymock' , name: 'easymock' , version:'3.3'
testCompile group: 'junit' , name: 'junit' , version:'4.12'
}

最佳答案

在gradle 2.1中,他们从HTTP到HTTPS的switched mavenCentral()。也许您的代理在使用HTTPS时遇到了麻烦(或者gradle在使用HTTPS时在代理方面有了麻烦)。您可以使用以下代码切换回HTTP(永久或仅用于测试此假设),该代码取自上述发行说明:

repositories {
// note: this replaces mavenCentral()
maven { url = 'http://repo1.maven.org/maven2/' }
}

并查看gradle用户指南中有关代理配置的“ Accessing the web via a proxy”。

关于gradle - Gradle从1.12升级到2.4后无法解决依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31541614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com