New to Grails and trying to use HttpClient from apache to use it on integration tests ... so i put it's dependencies:
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
// runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
test "org.grails:grails-datastore-test-support:1.0-grails-2.4"
compile 'org.apache.httpcomponents:httpcore:4.1.2'
compile 'org.apache.httpcomponents:httpclient:4.1.2'
build 'org.apache.httpcomponents:httpcore:4.1.2'
build 'org.apache.httpcomponents:httpclient:4.1.2'
test 'org.apache.httpcomponents:httpcore:4.1.2'
test 'org.apache.httpcomponents:httpclient:4.1.2'
}
in build.config and expected to be able to use it on tests like
class MyControllerTests extends GroovyTestCase {
@Test
void testApacheHttpClient() {
def client = new HttpClient()
}
}
However i cannot make it work because grails is unable to resolve any class.
I've tried with manual import without success.
What i am doing wrong?!
Thanks in advance.
You are missing Commons HttpClient
as a dependency.
You should add this to your dependencies:
test 'commons-httpclient:commons-httpclient:3.1'
Also be sure to import the correct class on your source code:
org.apache.commons.httpclient.HttpClient
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.