Richard Hsu
Richard Hsu

Reputation: 843

gradle build: repo1.maven.org: unknown error

I have a spring-boot app that I was able to start up the server in eclipse. However, when I goto terminal and do gradle compile, here is the console log i am getting:

    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

I am not entirely sure why this is happening: it seems like it is having some issues with proxy server, but if I were to do wget I can get the files under repo1.maven...

For reference, this is my 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'
}

Any idea why I can't build?

Upvotes: 1

Views: 4948

Answers (1)

Opal
Opal

Reputation: 84756

Proxy properties should be configured in gradle.properties file as stated in the docs.

Upvotes: 1

Related Questions