midnec wrote:
I love gradle, but I have hit a problem.  I am trying to execute an ant
target in a build.xml file from gradle.
When I execute the task from ant, it works. From gradle it does not work.
The build.gradle just imports the ant script (it is a sub-project).  The ant
task uses an optional ant task (sshexec).  The error is that ant can't find
the jar for the optional component.

There's no really nice solution to this problem. Here are some potential work-arounds:

An easy fix for this is to drop ant-jsch.jar and jsch.jar into $GRADLE_HOME/lib. This has a few problems, the main one in your case that it won't work with gradlew.

Another option is to inject the JARs into the appropriate classloader. Here's some code to do this. You only need to do this in one project per build - the root project would be a good option:

configurations { antssh }
dependencies { antssh group: 'org.apache.ant', name: 'ant-jsch', version: '1.7.0' }

configurations.antssh.each { File jar -> ant.getClass().classLoader.addURL(jar.toURL()) }

This should work fine with gradle or gradlew.

We will make it easier to use ant optional tasks in a later Gradle release. See http://jira.codehaus.org/browse/GRADLE-574


Adam


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to