KBEC-00409 - How to download 'Grape dependencies' when encountering 'Error grabbing Grapes '

Article ID:360033187091
2 minute readKnowledge base

Summary

A number of CloudBees CD (CloudBees Flow) plugins rely on Grapes as a way to download dependencies. When running a procedure for the first time or trying a new plugin, the system will use Grapes to download a list of Dependencies. During this download, an error may be observed similar to:

java.lang.RuntimeException: Error grabbing grapes

This error will cause the entire step to fail. Reattempting the procedure, may allow you to download more from the dependency list, but you may hit other errors. However, the Error messages will typically look similar, making it appear as if the step is failing at the same spot. In reality, it is attempting to download more dependencies but running into separate issues.

To get around this problem, it is advised to continuously force the download of the grapes jar or dependency that is missing from your installation. The following is a set of steps to download the http-builder module:

  1. Create a new procedure with a Command step:
    @Grab('com.amazonaws:aws-java-sdk-s3:1.9.30')
    @Grab(group = 'org.codehaus.groovy.modules.http-builder', module = 'http-builder', version = '0.7.1')
    def http = new groovyx.net.http.HTTPBuilder('https://www.codehaus.org')
    println http

  2. Set the shell of this step to:
    ec-groovy

  3. Run the procedure. If this procedure succeeds it will download the libraries to "/grape for example: "/opt/electriccloud/electriccommander/grape" folder.

  4. After the job completes Successfully, you can now use the Plugin’s procedure. The Libraries it requires will be in the /grape folder so it will not attempt to download them again.

If Step 3 fails, you will need to Run this again to force the Step to continue downloading the grapes libraries that were missed.

If Step 3 continues to fail after multiple runs, or if step 3 completes successfully and the Plugin’s procedure still fails with the same error message, please add this line into the 'shell' field of the relevant procedure:

ec-groovy -Divy.message.logger.level=4 -Dgroovy.grape.report.downloads=true

This should provide more information on what is going wrong with the process, and you can then forward that onto support@cloudbees.com for analysis.