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'
}
任何想法,我为什么不能建?
代理属性应该在'gradle.properties'文件中配置,如下所述:https://docs.gradle.org/current/userguide/build_environment.html#sec:accessing_the_web_via_a_proxy – Opal
@Opal你应该做出答案而不是评论。 –
@PeterLedbrook,我很难确定它是这种情况。将添加一个答案。 – Opal