gradle build:repo1.maven.org:未知错误

时间:2015-07-20 21:32:28

标签: java gradle spring-boot

我有一个spring-boot应用程序,我能够在eclipse中启动服务器。 但是,当我转到终端并进行gradle编译时,这是我得到的控制台日志:

    FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'springBootREST'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE.
     Required by:
         :springBootREST:unspecified
      > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE.
         > Could not get resource 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.2.5.RELEASE/spring-boot-gradle-plugin-1.2.5.RELEASE.pom'.
            > Could not HEAD 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.2.5.RELEASE/spring-boot-gradle-plugin-1.2.5.RELEASE.pom'.
               > repo1.maven.org: unknown error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

我不完全确定为什么会发生这种情况:它似乎与代理服务器有一些问题,但如果我要做wget我可以在repo1.maven下获取文件......

作为参考,这是我的build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
    }
}
// same as what is in my .bash_profile
systemProp.http.proxyHost='my proxy server'
systemProp.http.proxyPort='my proxy port'


apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'spring-boot'

group = 'lookupGroup'

jar {
    baseName = 'lookupService'
    version =  '0.1.0'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE'
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-actuator")
    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("junit:junit")
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.3'
}

知道我为什么不能建立?

1 个答案:

答案 0 :(得分:1)

应在gradle.properties文件中配置代理属性,如docs中所述。