Hi I need to call a REST service as part of the buildscript (Gradle) without any 3rd party plugins, how could I use Groovy to do that?
(My first attempt)
repositories { mavenCentral() } dependencies { complie "org.codehaus.groovy.modules.http-builder:http-builder:0.5.2" } task hello { def http = new HTTPBuilder("http://myserver.com:8983/solr/select?q=*&wt=json") http.auth.basic 'username', 'password' http.request(GET, JSON ) { req -> } }
Can't you just do
new URL( 'http://username:[email protected]:8983/solr/select?q=*&wt=json' ).text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With