Search code examples
gradlevagrantbuild.gradlemaven-central

Gradle Error When Trying to Download Dependencies in Vagrant


I am attempting to download a dependency from Maven Central, and it works on my host machine (OS X), but gives an error when I try to download the dependency in my vagrant box running CentOS.

This is the error:

Could not resolve all dependencies for configuration ':compileClasspath'.
    Could not resolve org.slf4j:slf4j-api:1.7.21.
     Required by:
         :gradle-2.14.1:1.0.SNAPSHOT
       Could not resolve org.slf4j:slf4j-api:1.7.21.
          Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
       Could not resolve org.slf4j:slf4j-api:1.7.21.
          Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory
       Could not resolve org.slf4j:slf4j-api:1.7.21.
          Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory 

since it works on my host machine, but not my vagrant machine, this seems to be an issue with vagrant. From what I have read on the internet about this error, it seems to be caused by proxy problems.

  • Does this mean that vagrant is acting as a proxy?
  • if so, how do I configure it?

Here is my build.gradle file:

apply plugin: 'java'

version = '1.0.SNAPSHOT'

sourceSets {
    main {
        java {
            exclude 'src/main/java/thirdparty/**'
            exclude 'src/main/java/thirdparty/closingmarket/**'
        }
    }
}

repositories {
    jcenter()
    mavenCentral()
    maven {
        url "https://mvnrepository.com/artifact"
    }
}

dependencies {
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
}

This is especially confusing because I can ping websites, wget, and use my yum repositories just fine.


Solution

  • The issue turned out to be a problem with the vendor. After switching from Oracle's installation to openJDK 1.6 I am now able to download dependencies.