Groovy Grape Turns Sour – java.lang.RuntimeException: Error grabbing Grapes — [download failed:


Issue:

Trying to run a Ratpack Groovy code [ @Grab(‘io.ratpack:ratpack-groovy:1.0.0’) ]

groovy -Dgroovy.grape.report.downloads=true -Dratpack.port=8081 server.groovy

The Error:

General Error:  

java.lang.RuntimeException: Error grabbing Grapes -- [download failed:

Specific Error:

java.lang.RuntimeException: Error grabbing Grapes -- [download failed: org.yaml#snakeyaml;1.12!snakeyaml.jar(bundle), download failed: com.google.guava#guava;18.0!guava.jar(bundle)]

The fix:

Delete the Repository folders in repo managers like Maven.

Why? Because the ~/.groovy/grapes repo for the dependency has the property file configured to read from Maven Repo instead of the Remote Repo (cannot download because it is not a HTTP link)

Detailed Steps:

  1. Step 1:  Use Grape Resolve to load the dependency and show the error

    “grape resolve  com.google.guava guava 18.0″

  2. Step 2:  Find the dependency property and figure out where this is pulling from

    cat ~/.groovy/grapes/com.google.guava/guava/ivydata-18.0.properties

    #ivy cached data file for com.google.guava#guava;18.0
    #Thu Oct 01 15:49:19 AEST 2015
    artifact\:ivy\#ivy\#xml\#1163610380.original=artifact\:guava\#pom.original\#pom\#361716139
    artifact\:guava\#pom.original\#pom\#361716139.original=artifact\:guava\#pom.original\#pom\#361716139
    resolver=localm2
    artifact\:guava\#pom.original\#pom\#361716139.exists=true
    artifact\:ivy\#ivy\#xml\#1163610380.exists=true
    artifact\:ivy\#ivy\#xml\#1163610380.location=file\:/Users/alokmishra/.m2/repository/com/google/guava/guava/18.0/guava-18.0.pom
    artifact.resolver=localm2
    artifact\:guava\#pom.original\#pom\#361716139.location=file\:/Users/alokmishra/.m2/repository/com/google/guava/guava/18.0/guava-18.0.pom
    artifact\:ivy\#ivy\#xml\#1163610380.is-local=true
    artifact\:guava\#pom.original\#pom\#361716139.is-local=true
  3. Step 3: Delete from Maven
    1. Locate the Dependency in your ~/.m2/repository
    2. Delete the repository for this Dependency
      1. rm -r -f /Users/alokmishra/.m2/repository/com/google/guava/
    3. Delete the repository from Groovy
      1.  rm -r -f /Users/alokmishra/.groovy/grapes/com.google.guava/guava/
  4. Step 4: Retest
    1. grape resolve  com.google.guava guava 18.0

      /Users/alokmishra/.groovy/grapes/com.google.guava/guava/jars/guava-18.0.jar
    2. groovy -Dgroovy.grape.report.downloads=true -Dratpack.port=8081 server.groovy

      [SUCCESSFUL ] com.google.guava#guava;18.0!guava.jar(bundle) (4353ms)

Leave a Comment