I’m a little lost:)
I have a simple gradle file where I added the groovy http-builder libraray:
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:
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:
/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:
..
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