groovyjenkins-pluginsivyjenkins-job-dslgroovy-grape

Downloading dependencies using grape with Jenkins Job DSL plugin error


I did a job using Jenkins Job DSL plugin to get SVN branches with SVNKit libraries, but I have one problem setting de jar libraries using Grape (which uses Ivy).

If I set this in my script:

@Grapes( 
    @Grab(group='org.tmatesoft.svnkit', module='svnkit', version='1.8.3') 
)
import org.tmatesoft.svn.core.SVNDirEntry
import org.tmatesoft.svn.core.SVNNodeKind
...
...

I get the following error:

FATAL: startup failed:
General error during conversion: Error grabbing Grapes -- [download failed: net.java.dev.jna#jna;3.5.2!jna.jar]

java.lang.RuntimeException: Error grabbing Grapes -- [download failed: net.java.dev.jna#jna;3.5.2!jna.jar]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    ...

It's quite curious because if I go to %USERPROFILE%\.groovy\grapes\org.tmatesoft.svnkit\svnkit\jars the jars of SVNKIT are there but for some strange reason Grapes can't download JNA jars.

I workaround this problem downloading JNA jar in the grapes path, and it worked, but I would like what is happening and how to do this in the right way.

I'm using:

UPDATE: I don't know why, but now after delete de .groovy folder, seems that is working ok.

I guess that I had a network problem while I try to get JNA for the first time and Ivy decided to set JNA as broken link on Maven Central. The reason why now works could be because after I delete the .groovy folder, Grape tried to download and this time network was ok.

It would be nice if someone can clarify this :)


Solution

  • I think sometimes when dependencies are being resolved with Grapes (and perhaps other similar technologies), some flag is toggled before the dependency gets fully downloaded or configured properly. I have had this happen with Maven and Gradle as well and the problem is usually resolved by blowing away cached artifacts in .m2 or .gradle and force them to be fetched again.