groovyimportgroovy-grape

Actually installing Grape imports


I have a script that I quickly put up using a @Grab annotation to import a package - namely HttpBuilder. Now I would like to actually install HttpBuilder and get rid of the annotation before putting the script in production - I do not want to grab the dependency dynamically on the prod server.

How do I actually tell Grape to install the dependency once and for all? Is there even a way to do this? If not, how should I install this package before deploying?

EDIT Following the advice from tim_yates, I donwloaded all teh JARs from HttpBuilder website, and added them to the classpath. But, when I run groovy -cp dependencies/* myApp.groovy what I get is a bunch of errors like

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/path/to/dependencies/httpclient-4.0.3.jar: 1: unexpected char: 0x3 @ line 1, column 3.
   PK
     ^

What does this mean?


Solution

  • If you go to the Downloads page for HttpBuilder, you can follow the links in the first paragraph and download the http-builder-xxx-all.zip for the release you want...

    Expand this, and it contains the jar, and the dependency jars in the dependencies folder

    Then, just add them to the classpath in the usual way and get rid of the @Grab line