2

gradle build在我的 gradle.properties 文件上运行时出现以下错误。

我知道我在防火墙后面,并且我有一个可以使用的 poxy。我尝试将以下内容添加到我的 gradle.properties 文件中,但我无法下拉 jUnit。所有帮助表示赞赏!

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080

错误:

Error listing versions of junit#junit;4.+ using class 
org.gradle.api.internal.artifacts.repositories.resolver.MavenVersionLister$1. 
Will attempt an alternate way to list versions. This behaviour has been 
deprecated and is scheduled to be removed in Gradle 2.0

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':testRuntime'.
> Could not resolve junit:junit:4.+.
  Required by:
      :HealthMonitor:1.0
   > Failed to list versions for junit#junit;4.+.
      > Could not list versions using M2 pattern 'http://repo1.maven.org/maven2/
[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]'.
         > Could not GET 'http://repo1.maven.org/maven2/junit/junit/'.
            > Connection to http://repo1.maven.org refused

构建.gradle:

apply plugin: 'java'
apply plugin: 'eclipse'

version = '1.0'
jar {
    manifest {
        attributes 'Implementation-Title': 'Health Monitor', 'Implementation-Version': version
    }
}

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.+'
}
4

1 回答 1

0

根据代理的不同,您可能需要配置的不仅仅是主机和端口。请参阅Gradle 用户指南中的通过代理访问 Web 。另外,我建议尝试使用固定版本而不是版本范围。

于 2013-02-19T00:29:53.117 回答