1
votes

I need to install a dependency but I can't seem able to do so. The jar I need is this one: json-lib\2.3\json-lib-2.3-jdk15.jar I have found it here: http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.3 I tried to resolve the dependency in BuildConfig

dependencies {
    compile 'net.sf.json-lib:json-lib:2.3'

}

I also tried in plugins. It is not working. The error is: Resolve error obtaining dependencies: Could not find artifact net.sf.json-lib:json-lib:jar:2.3 in grailsCentral (https://repo.grails.org/grails/plugins)

I am using grails 2.4.5 I have also thought to use the grails command to look for the dependency on a specific repository but I do not know on what repository I can find this dependency

2

2 Answers

1
votes

It looks like net.sf.json-lib:json-lib:2.3 is from http://central.maven.org/maven2

Make sure you add the repository URL in the list of repositories in BuildConfig.groovy.

mavenRepo 'http://central.maven.org/maven2'

There is a newer version of jar file, in case you are interested using that.

0
votes

I have actually found the solution to this. By using grails dependency-report, I managed to understand the hierarchy of dependencies. I realised that the dependency I really need is the following http-builder

+--- org.codehaus.groovy.modules.http-builder:http-builder:0.7.1

| --- org.apache.httpcomponents:httpclient:4.2.1 | --- net.sf.json-lib:json-lib:2.3

So, I added to the dependencies section

 compile('org.codehaus.groovy.modules.http-builder:http-builder:0.7.1')

Without any additional specific repositories.