Problem when running ant task that calls sshexec from gradle

We are trying to convert our project to use Gradle and as an initial step we simply imported our build.xml on our build.graddle file and called the appropriate target.

We are using the eclipse gradle plugin to run it, and for the most part it seems to work, but we are hitting an issue when the target executed uses the ant task sshexec:

<target name="copy-files">
		<sshexec host="${linux.host}" username="${linux.username}" keyfile="${linux.password}"
             command="mkdir -p ${linux.release.dir}" trust="true" failonerror="false"/>
		<scp todir="${linux.username}@${linux.host}:${linux.release.dir}" keyfile="${linux.password}" trust="true">
			<fileset dir="${build.dist.release.id.dir}">
				<include name="**/*.*"/>
			</fileset>
		</scp>
	</target>

our build.gradle file looks like:

// Apply the java plugin to add support for Java
apply plugin: 'java'
ant.importBuild 'build.xml' 

when I run this i get:

Caused by: build.xml:65: Problem: failed to create task or type sshexec
Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found.
This looks like one of Ant's optional components.
Action: Check that the appropriate optional JAR exists in
-ANT_HOME\lib

From what I read online I am supposed to add this library as part of my dependencies. This is what I currently have on our build.gradle file but I have tried other different formats but all of them return the same error:

repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}

configurations {
    antClasspath
}

dependencies {
    
    antClasspath files('lib/ssh/jsch-0.1.42.jar')
}

The jsch library is currently sitting on a subfolder of the project in my local PC.

I have tried replacing “antClasspath” with “compile” instead and get the same error.

All the posts similar to my issue that I have seen online haven’t resolve my problem.
Any help would be appreciated.
Thanks