5

I have a Groovy file having following code :

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' )

I am trying to download the dependencies to use HTTPBuilder.

But it's showing me the error as follows :

Error grabbing Grapes -- [download failed: org.apache.httpcomponents#httpclient;4.2.1!httpclient.jar,download failed: org.apache.httpcomponents#httpcore;4.2.1!httpcore.jar, download failed: commons-codec#commons-codec;1.6!commons-codec.jar, download failed: commons-beanutils#commons-beanutils;1.8.0!commons-beanutils.jar, download failed: commons-lang#commons-lang;2.4!commons-lang.jar]

I tried resolving this Grape dependency using below command in command prompt :

grape resolve org.codehaus.groovy.modules.http-builder http-builder 0.7.2

I also tried the below one too :

grape install org.codehaus.groovy.modules.http-builder http-builder 0.7.2

then also it is showing me the same error. How can I solve this problem? I use Groovy version 2.2.2.

halfer
  • 19,824
  • 17
  • 99
  • 186
Prashant2329
  • 327
  • 3
  • 7
  • 21
  • I tried grabbing another randomly chosen dependency : `@Grab(group='org.springframework', module='spring', version='2.5.6')` even this is also failing to download ... – Prashant2329 Sep 02 '14 at 07:28
  • I think no any dependency is being added using **@Grab** annotation ... – Prashant2329 Sep 02 '14 at 07:29
  • have you looked into other questions with the same problem first? e.g. http://stackoverflow.com/questions/16871792/groovy-grab-download-failed – cfrick Sep 02 '14 at 07:52
  • Kudos to you cfrick .. You solved my problem of getting the dependency onto my system(SUCCESSFULLY COMPILED). But in runtime my `.groovy` file, it's saying `NoClassDefFound` error for `HTTPBuilder` class.. Even when I am having all the dependencies needed. Can you please do me one more favour. – Prashant2329 Sep 02 '14 at 09:11
  • Solved my problem. I deleted `grapes` folder present in `.groovy` folder(in user's root directory) and Again compiled my `script.groovy` file.. Many many thnx to you @cfrick – Prashant2329 Sep 02 '14 at 09:22

1 Answers1

5

From cfrick's referred link(as mentioned in comment),

I created grapeConfig.xml as mentioned in accepted answer of the link (Groovy - Grab - download failed)

and successfully able to get all the dependencies to my system. That's what I was looking for.

Community
  • 1
  • 1
Prashant2329
  • 327
  • 3
  • 7
  • 21