SVNKit cannot use JNA for Gradle builds


I’m using SVNKit in my build logic, but it somehow fails to get the cached credentials under Windows. I learned that this is only accessible using the native SVN backend, which fails to load with the great exception:
java.lang.UnsatisfiedLinkError: Can't obtain updateLastError method for class com.sun.jna.Native
I found that this is a mismatch between the JNA jar 4.x and its native counterpart in version 3.x.
SVNKit brings in JNA 4.1 via its transitive closure, but Gradle still provides the native library in version 3.2.7.

tl;dr Gradle uses quite an old version of JNA

I was able to work around the issue like this

buildscript {
    configurations.classpath {
        resolutionStrategy.force ''

but it’s obviously not a pretty solution altering the major version of some dependency, making the build now dependent upon a specific Gradle version’s implementation detail (I’m using Gradle 2.10 here).

Is there a better way to solve this?
Are there any plans about whether Gradle will update JNA in the foreseeable future, or is it safe to trust that this will stay on 3.2.7?

Best regards,

Unfortunately, no, I don’t think there is currently a better solution. Gradle only uses jna on the Windows platform and only because it is a requirement of jansi (for controlling the console). I would expect any changes to this would involve upgrading the version of jansi which I believe would remove the need for jna (not confirmed beyond looking at the poms for newer versions of jansi). So, I think it would be safe to say that Gradle will still use 3.2.7 for the foreseeable future until it likely removes the need for it altogether.

That sounds like my workaround could end up being pretty stable. Thanks a lot for the answer!