grailsdependencieshttpclientgrails-config

how to get version 4.0 of httpclient off of my classpath in grails


I am using Grails 1.3.7 and cannot figure out how to get version 4.0 of httpclient off of my classpath (in favour of 4.1). I need to do this because of a no-args constructer used in 4.1 that the plugin relies on.

Running a grails 'dependency-report', it appears that 4.1 should be the one being used at runtime. And it IS, if I package things up into a .war. HOWEVER version 4.0 is still ending up on the classpath when using run-app for some reason. Note it is (correctly) being used at compile time for some grails internals, and somehow it is still ending up on my classpath.

-> Can I figure out where exactly that 4.0 .jar is coming from and ending up on my classpath and stop it from happening (where are all the .jars put when running via run-app?)

-> Can I tell grails to compile with 4.1 instead of 4.0 for its internals (in this case the http-builder by org.codehaus.groovy.modules.http-builder module?) Arguable not the best solution but I'll take it, as packaging everything into a .war every time I want to test it is not pleasant.

Help would be greatly appreciated.


Solution

  • I just went through the same thing, add the following to your BuildConfig.groovy

    dependencies {        
            build 'org.apache.httpcomponents:httpcore:4.1.2' 
            build 'org.apache.httpcomponents:httpclient:4.1.2' 
            runtime 'org.apache.httpcomponents:httpcore:4.1.2'
            runtime 'org.apache.httpcomponents:httpclient:4.1.2'
    } 
    

    cheers

    Lee