What’s the right way to use an optional ant task within a custom gradle task defined in my plugin?
I have a plugin and am trying to implement an rsync like ability and I’m wrapping ant’s scp task because I don’t want to reimplement it. Is this possible? I’m also concerned that this will work on during plugin development but require all kind of classpath manuvers when I try to use the plugin.
It used to run but now fails thus:
Caused by: jar:file:/builds/tools/Common/gradle/gradle-2.0/lib/ant-1.9.3.jar!/org/apache/tools/ant/antlib.xml:37:
Problem: failed to create task or type componentdef
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
In plugin’s build.gradle
compile 'jsch:jsch:0.1.29’
compile 'javamail:javamail:1.3.2’
compile gradleApi()
In RemoteCopy.groovy
def ant = new AntBuilder()
ant.project.getBuildListeners().firstElement().setMessageOutputLevel(3)
ant.sshexec(host: host, username: user,
keyfile: keyfile.absolutePath,
passphrase: “”,
trust: “yes”,
command: “mkdir -p ${remoteDestinationPath}”,
verbose: “true”)
ant.scp(todir: "${user}@${host}:${remoteDestinationPath}",
keyfile: keyfile.absolutePath,
passphrase: "",
trust: "yes",
verbose: "true",
failonerror: "true") {
fileset(dir: fromDir) {
include(name: copyPattern)
}
}