Groovy Grape: Troubleshooting Failed Download

If you use the Grape's @Grab annotation to get dependencies for your Groovy scripts at runtime and their retrieval fails with the exception "General error during conversion: Error grabbing Grapes -- [unresolved dependency: ...not found]" and a useless stack trace then you migth want to know that you can configure Ivy to log all the details of what is going on (what it is trying to download, where from, ...), for example in the interactive groovysh shell:


groovy:000> org.apache.ivy.util.Message.setDefaultLogger(new org.apache.ivy.util.DefaultMessageLogger(org.apache.ivy.util.Message.MSG_DEBUG))
groovy:000> groovy.grape.Grape.grab(autoDownload: true, group: 'org.eclipse.jetty.orbit', module: 'javax.servlet', version: '3.0.0.v201112011016')
...
WARN: ==== ibiblio: tried
WARN:   http://repo1.maven.org/maven2/org/eclipse/jetty/orbit/javax.servlet/3.0.0.v201112011016/javax.servlet-3.0.0.v201112011016.orbi
...


You can likely also increase the log level by setting the system property ivy.message.logger.level to 4 (debug, see the Ivy Message class.)

(For the list of arguments that grab supports see GrapeIvy, namely the method createGrabRecord [btw, ext and type are ignored unless you also set classifier] this has been fixed)

Tags: java groovy


Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob