# Compiler error - very strange problem with dependencies

**URL:** <https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262>\
**Category:** Old Forum Archive\
**Created:** [January 22, 2014, 11:03pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262 "2014-01-22T23:03:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![leifhanack](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@leifhanack](https://discuss.gradle.org/u/leifhanack)\
**Post date:** [January 22, 2014, 11:03pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/1 "2014-01-22T23:03:00Z")

</div>

I’m a little lost:)

I have a simple gradle file where I added the groovy http-builder libraray:

```gradle
dependencies {
    compile "org.springframework.boot:spring-boot-starter-web:${springBootStarterVersion}"
  compile "org.springframework.boot:spring-boot-starter-actuator:${springBootStarterVersion}"
    testCompile 'org.codehaus.groovy.modules.http-builder:http-builder:0.6'
  }

```

Next I have a groovy test case with:

```gradle
import org.junit.Test
import groovyx.net.http.RESTClient
  class MyContractTest {
    @Test
  public void testIt() {
    def client = new RESTClient("http://localhost:8000")
    def resp = client.get(path : "/")
      assert resp.status == 200
    assert resp.data.text == "Greetings from Spring Boot!"
  }
}

```

When I run ‘gradle compileTestGroovy’ I get:

```gradle
/Users/leif.hanack/projects/sample/src/test/groovy/MyContractTest.groovy: 2: unable to resolve class groovyx.net.http.RESTClient
 @ line 2, column 1.
   import groovyx.net.http.RESTClient
   ^
  1 error

```

Checking the deps show me that the lib is part of the classpath:

```gradle
..
testCompile - Compile classpath for source set 'test'.
+--- org.codehaus.groovy:groovy-all:2.1.1
+--- org.springframework.boot:spring-boot-starter-web:1.0.0.RC1
|
  +--- org.springframework.boot:spring-boot-starter:1.0.0.RC1
..
\--- org.codehaus.groovy.modules.http-builder:http-builder:0.6
     +--- org.apache.httpcomponents:httpclient:4.2.1
     |
  +--- org.apache.httpcomponents:httpcore:4.2.1
     |
  +--- commons-logging:commons-logging:1.1.1
     |
  \--- commons-codec:commons-codec:1.6
     +--- net.sf.json-lib:json-lib:2.3
     |
  +--- commons-beanutils:commons-beanutils:1.8.0
     |
  |
  \--- commons-logging:commons-logging:1.1.1
     |
  +--- commons-collections:commons-collections:3.2.1
     |
  +--- commons-lang:commons-lang:2.4
     |
  +--- commons-logging:commons-logging:1.1.1
     |
  \--- net.sf.ezmorph:ezmorph:1.0.6
     |
       \--- commons-lang:commons-lang:2.3 -> 2.4
     +--- org.codehaus.groovy:groovy:1.8.8
     |
  +--- antlr:antlr:2.7.7
     |
  +--- asm:asm:3.2
     |
  +--- asm:asm-commons:3.2
     |
  |
  \--- asm:asm-tree:3.2
     |
  |
       \--- asm:asm:3.2
     |
  +--- asm:asm-util:3.2
     |
  |
  \--- asm:asm-tree:3.2 (*)
     |
  +--- asm:asm-analysis:3.2
     |
  |
  \--- asm:asm-tree:3.2 (*)
     |
  \--- asm:asm-tree:3.2 (*)
     +--- net.sourceforge.nekohtml:nekohtml:1.9.16
     |
  \--- xerces:xercesImpl:2.9.1
     |
       \--- xml-apis:xml-apis:1.3.04
     \--- xml-resolver:xml-resolver:1.2

```

Next I tried that code on another machine and it worked! I checked that I have the same versions for groovy, gradle, IntellijIdea, but that simple test won’t compile.

Did anyone have had such a strange problem?

Thanks a lot for any pointer!

Regards, Leif

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [January 22, 2014, 11:13pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/2 "2014-01-22T23:13:00Z")

</div>

The first thing I would check is, if it’s working on a clean cache. try building with “-g .” to relocate the cache for the build

---

<div class="post-metadata">

**Author:** ![leifhanack](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@leifhanack](https://discuss.gradle.org/u/leifhanack)\
**Post date:** [January 22, 2014, 11:21pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/3 "2014-01-22T23:21:00Z")

</div>

Thanks Rene, unfortunately it doesn’t helped.

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [January 22, 2014, 11:45pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/4 "2014-01-22T23:45:00Z")

</div>

hmm. hard to say what’s going wrong in your code. just double checked in on my machine and it works fine here. can you double check the compile classpath by adding

```gradle
compileTestGroovy{
 doFirst{
  println classpath.asPath
 }
}

```

and checking if http-builder is listed?

---

<div class="post-metadata">

**Author:** ![leifhanack](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@leifhanack](https://discuss.gradle.org/u/leifhanack)\
**Post date:** [January 23, 2014, 9:04am UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/5 "2014-01-23T09:04:00Z")

</div>

Mmmh?!

```gradle
:/Users/leif.hanack/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy.modules.http-builder/http-builder/0.6/ca89dfdfdb9ef1d2c3eb4a7d6a96985f0d656fb9/http-builder-0.6.jar:

```

Weired!

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [January 23, 2014, 9:08am UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/6 "2014-01-23T09:08:00Z")

</div>

really weired. Have you tested if it makes a different to build it “with daemon” / “without daemon”? Do you have any other buildlogic (maybe injected by a parent project or auto applied init scripts) that might interfer here? really hard to say at this point what’s going on here

---

<div class="post-metadata">

**Author:** ![leifhanack](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@leifhanack](https://discuss.gradle.org/u/leifhanack)\
**Post date:** [January 23, 2014, 10:57am UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/7 "2014-01-23T10:57:00Z")

</div>

I’ll retry it tonight with a striped down version and will let you know the results.

Thanks so far!

---

<div class="post-metadata">

**Author:** ![leifhanack](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@leifhanack](https://discuss.gradle.org/u/leifhanack)\
**Post date:** [January 23, 2014, 10:22pm UTC](https://discuss.gradle.org/t/compiler-error-very-strange-problem-with-dependencies/2262/8 "2014-01-23T22:22:00Z")

</div>

Alrighty, I found the problem!

```gradle
repositories {
    mavenLocal()
    maven {
      url project["nexus.public.url"]
      credentials {
        username project["nexus.username"]
        password project["nexus.password"]
      }
    }
    mavenCentral()
  }

```

The 2nd repository (“nexus.public.url”) points to our corporate network. If that is not reachable it seems as if the 3rd (mavenCentral) is not taken to resolve the dependencies.

If I comment out the corporate repository everything works as expected.

I have sent you a sample project which should help to reproduce it.

Regards, Leif
