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:
- Step 1: Use Grape Resolve to load the dependency and show the error
“grape resolve com.google.guava guava 18.0″
-
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
- Step 3: Delete from Maven
- Locate the Dependency in your ~/.m2/repository
- Delete the repository for this Dependency
-
rm -r -f /Users/alokmishra/.m2/repository/com/google/guava/
-
- Delete the repository from Groovy
-
rm -r -f /Users/alokmishra/.groovy/grapes/com.google.guava/guava/
-
- Step 4: Retest
-
grape resolve com.google.guava guava 18.0
/Users/alokmishra/.groovy/grapes/com.google.guava/guava/jars/guava-18.0.jar
-
groovy -Dgroovy.grape.report.downloads=true -Dratpack.port=8081 server.groovy
[SUCCESSFUL ] com.google.guava#guava;18.0!guava.jar(bundle) (4353ms)
-