Milestone-8 : jsch-0.1.42.jar missing, Ivy SFTPResolver can not be be used anymore


(Stephane Galles) #1

Whem migrating from milestone-7 to milestone-8 :

java.lang.ClassNotFoundException: com.jcraft.jsch.JSchException

Related to

uploadArchives {
   repositories {
    add(new org.apache.ivy.plugins.resolver.SFTPResolver()) {
...

Indeed, jsch-0.1.42.jar is not provided anymore in the lib directory of Gradle, I’ve tried to add this lib in milestone-8 lib directory but it does not work either.

I’ve also tried to insert jsch-0.1.42 in the buildscript classpath, but it does not work (The Ivy lib must be in Gradle classloader I guess)

Any idea ? Thank you.


#2

Thanks for the report. Our test coverage for built-in ivy resolvers is clearly inadequate. I’ve raised GRADLE-2104 for this.

I’m not aware of a workaround at this time, sorry. If I discover one, I’ll let you know.


#3

Can you try something like this in your build script? It’s a hack, but it should add jsch to the correct classloader.

import org.apache.ivy.plugins.resolver.SFTPResolver
  buildscript {
    repositories { mavenCentral() }
    dependencies.classpath 'com.jcraft:jsch:0.1.46'
}
  def jsch = buildscript.configurations.classpath.files { it.name == "jsch" }.toList().first()
println SFTPResolver.classLoader.addURL(jsch.toURL())

(Stephane Galles) #4

Yes ! works like a charm !

Thank for the very quick answer, and the workaround too.

The mere fact that you were able to create such a workaround convinces me (once again) that Gradle is a powerful tool.

(and, someone already said this in this forum, but I reiterate, thank you too for the quality of the documentation)


(Matias Bjarland) #5

+1. Thanks go to the gradle team for the superbly responsive attitude and all the great answers on these forums. Living on the bleeding edge with blood dripping from your extremities is only possible with great support like this.