# buildSrc compileGroovy FAILED: unable to resolve class

**URL:** <https://discuss.gradle.org/t/buildsrc-compilegroovy-failed-unable-to-resolve-class/26403>\
**Category:** Help/Discuss\
**Created:** [March 26, 2018, 7:33pm UTC](https://discuss.gradle.org/t/buildsrc-compilegroovy-failed-unable-to-resolve-class/26403 "2018-03-26T19:33:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [March 26, 2018, 7:33pm UTC](https://discuss.gradle.org/t/buildsrc-compilegroovy-failed-unable-to-resolve-class/26403/1 "2018-03-26T19:33:02Z")

</div>

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.*`):

```gradle
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`:

```gradle
import org.cloudfoundry.client.lib.CloudCredentials

class CloudFoundryEnv {
    CloudCredentials _creds

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

```

Here is the compilation error:

```gradle
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
   ^

```

---

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [March 26, 2018, 8:34pm UTC](https://discuss.gradle.org/t/buildsrc-compilegroovy-failed-unable-to-resolve-class/26403/2 "2018-03-26T20:34:58Z")

</div>

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

```gradle
import org.cloudfoundry.client.lib.CloudCredentials

```

…but not this one:

```gradle
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?

---

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [March 26, 2018, 9:32pm UTC](https://discuss.gradle.org/t/buildsrc-compilegroovy-failed-unable-to-resolve-class/26403/3 "2018-03-26T21:32:21Z")

</div>

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