Reputation: 753
I have a strange behaviour in my grails 2.3.6 app.
I'd like to use groovyx.net.http.HTTPBuilder but IDE reports that it's unable to resolve the class.
So, I added the following line to my BuildConfig.groovy:
build "org.codehaus.groovy.modules.http-builder:http-builder:0.7"
But I get the following exception:
$ grails run-app MyApp
| Configuring classpath
| Error Resolve error obtaining dependencies: Could not find artifact org.codehaus.groovy.modules.http-builder:http-builder:zip:0.7 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
| Error Could not find artifact org.codehaus.groovy.modules.http-builder:http-builder:zip:0.7 in grailsCentral (http://repo.grails.org/grails/plugins)
| Run 'grails dependency-report' for further information.
My repositories in BuildConfig.groovy:
mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
mavenRepo "http://repo.spring.io/milestone/"
mavenRepo "http://www.hibernatespatial.org/repository"
mavenRepo "https://oss.sonatype.org/content/groups/public/"
mavenRepo "http://repo.grails.org/grails/core"
The strange thing is that it should be there: http://repo.grails.org/grails/webapp/search/artifact/?1&q=http-builder
Any thoughts? I cleaned up, deleted ~/.m2, ~/.groovy, ~/.grails
Thanks!
Upvotes: 4
Views: 6962
Reputation: 187499
The problem is the scope of your dependency, it should be compile
rather than build
. In other words, replace this
build "org.codehaus.groovy.modules.http-builder:http-builder:0.7"
with
compile "org.codehaus.groovy.modules.http-builder:http-builder:0.7"
If you're still having problems, cross-reference your BuildConfig.groovy
with this one, which correctly declares a dependency on this library.
Upvotes: 3