2015-07-20 95 views
1

我有一個彈簧啓動應用程序,我可以在eclipse中啓動服務器。 然而,當我轉到終端,做gradle這個編譯,這裏是控制檯日誌中我得到:gradle build:repo1.maven.org:未知錯誤

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

代理屬性應該在'gradle.properties'文件中配置,如下所述:https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy – Opal

+0

@Opal你應該做出答案而不是評論。 –

+0

@PeterLedbrook,我很難確定它是這種情況。將添加一個答案。 – Opal

回答

1

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