I’m trying to use the sshexec optional task with Gradle which fails with a
No such property: sshexec for class: org.gradle.api.internal.project.DefaultAntBuilder
I’ve read on several places on the internet that a solution would be to create a new configuration (for example called antClasspath), declare the ant-jsch package as a dependency in this configuration and then somehow (different ideas in different posts) modify the ant classpath to include the new package. However, I’m not even able to add it as a dependency to the new configuration. I’m using the following code:
buildscript {
configurations {
antClasspath
}
dependencies {
println("All configs: " + configurations.toList())
println("All configs for project: " + project.configurations.toList())
antClasspath 'org.apache.ant:ant-jsch:1.8.2'
}
When I run a task, I get the following output:
All configs: [configuration ':classpath']
All configs for project: [configuration ':antClasspath']
FAILURE: Build failed with an exception.
* Where:
Build file 'build.gradle' line: 247
* What went wrong:
A problem occurred evaluating root project 'test'.
> No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.antClasspath() is applicable for argument types: (java.lang.String) values: [org.apache.ant:ant-jsch:1.8.2]
So it seems like the configuration I add in the buildscripts closure is added to the project instead of whatever I’m configuring in the buildscript closure.
I might be missing something obvious here, but all documentation I read makes me think that I should be able to do what I’m doing…