Hallo,
we use http builder, but with some problems:
First Problem: I have following gralde build script:
buildscript {
repositories {
maven {
credentials {
username repoUsername
password repoPassword
}
url 'http://our-url'
}
// Add here your classpath libs / build dependencies
dependencies {
classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.5.2"
}
}
}
When I try to run a task, where the http Builder class is used, I get following error:
startup failed: [exec] Script1.groovy: 1: unable to resolve class groovyx.net.http.HTTPBuilder [exec] @ line 1, column 1. [exec] new groovyx.net.http.HTTPBuilder( “http://${x}:${y}”) [exec] ^ [exec] 1 error
What do I do false?
Second Problem: So I have tried to do add the build dependecy so on that kind: configurations{ buildDependencies } dependencies {
buildDependencies( ‘org.codehaus.groovy.modules.http-builder:http-builder:0.5.2’ ) { exclude group:‘org.codehaus.groovy’, module:‘groovy’ }
}
// following line add libs to script classpath
configurations.buildDependencies.each {File file -> GroovyObject.class.classLoader.addURL(file.toURL());}
As you see, I add the build dependency to the class path. The most time I run that tasks of this scripts, it is no problem. But sometimes, when I set up a new project and many libs must be downloaded I get an error. Then, when I comment out the line
"buildDependencies( 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' ) { exclude group:'org.codehaus.groovy', module:'groovy' }"
I have no problem, it works. Then after the dependencies are downloaded, I can make the builddependency line active.
So how is it possible to use the “org.codehaus.groovy.modules.http-builder:http-builder:0.5.2” ?? Without getting errors? I thank you very much for answering and help me fixing that problem!
It should be possible to use 'classpath “org.codehaus.groovy.modules.http-builder:http-builder:0.5.2” ’ in my dependency, but it is not possible. So what is the wayx to use that dependency without getting errors?
Thanks very much for you help!
My mistake… It works!! Great work!! Thank you for you help! You are great that you have shown me the right way!!