buildSrc compileGroovy FAILED: unable to resolve class


(Hoobajoob) #1

Seems like I must be missing something obvious, but I keep getting a compile error for an import statement in a groovy class under buildSrc.

Here is the buildSrc/build.gradle file (mavenPublicRepoUrl comes from gradle.properties, and successfully resolves everything listed in the dependencies block, including the jar that contains org.cloudfoundry.client.lib.*):

apply plugin: 'groovy'
repositories {
    maven {
        url mavenPublicRepoUrl
    }
}
dependencies {
    compile 'org.yaml:snakeyaml:1.19'
    compile 'org.cloudfoundry:cloudfoundry-client-reactor:3.8.0.RELEASE'
    compile 'org.cloudfoundry:cloudfoundry-operations:3.8.0.RELEASE'
    compile 'io.projectreactor:reactor-core:3.1.5.RELEASE'
    compile 'io.projectreactor.ipc:reactor-netty:0.7.5.RELEASE'
}

Here is the groovy class in buildSrc/src/main/groovy:

import org.cloudfoundry.client.lib.CloudCredentials

class CloudFoundryEnv {
    CloudCredentials _creds

    CloudFoundryEnv( String theUser, String thePassword, URI theUrl ) {
    }
}

Here is the compilation error:

buildSrc\src\main\groovy\CloudFoundryEnv.groovy: 1: unable to resolve class org.cloudfoundry.client.lib.CloudCredentials
 @ line 1, column 1.
   import org.cloudfoundry.client.lib.CloudCredentials
   ^

(Hoobajoob) #2

Interestingly, the compile is able to successfully resolve this import statement, as described in the original post:

import org.cloudfoundry.client.lib.CloudCredentials

…but not this one:

import org.cloudfoundry.client.CloudFoundryClient

…the only difference I can see is that the failing import is for a class that is a transitive dependency of the dependencies listed in buildSrc/build.gradle.

Should that matter?


(Hoobajoob) #3

Nope - the client.lib.* classes aren’t transient dependencies - I was missing a dependency. Never mind!