0

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.

Justin Hoyt
  • 148
  • 1
  • 9
  • 1
    what are the JVM version/vendor on your host and guest - also do you have same gradle version on host and guest ? – Frederic Henri Aug 05 '16 at 19:27
  • I'm on jdk 1.8 on my host machine, but I have to be on jdk 1.6.0_45 on my guest for the codebase. i'll try jdk 1.8 on my guest machine and report back – Justin Hoyt Aug 05 '16 at 20:03
  • try to use also from the same vendor (openJDK, Oracle....) – Frederic Henri Aug 05 '16 at 20:10
  • I don't know what vendor my host machine uses, but I know I use Oracle for my guest machine. I tried the build with Oracle's jdk1.7.0_67 on my guest machine and found the same issue. I will attempt it with an openJDK installation to see if that helps. Thank you for the help! Do you think something besides the jdk version/vendor could be the problem? I still think the issue lies in a vagrant configuration. – Justin Hoyt Aug 08 '16 at 15:16

1 Answers1

0

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.

Justin Hoyt
  • 148
  • 1
  • 9