On Feb 3, 2009, at 10:07 AM, ales wrote:
Hi all,
I would like to use Ant optional tasks in the Gradle build. For
example FTP. If I copy ant-optional.jar and NetComponents.jar into
the directory GRADLE_HOME/lib directory it works fine but there is
one disadvantage, in this case these libraries must be copied to all
Gradle installations on other computers. It will be very helpful for
me do something like this in the build.gradle:
dependencies {
// automatically download optional tasks JAR and set it to
classpath...
downloadDependencyAndSetToMainClassPath 'ant:ant-optional:1.5.3-1'
}
...
createTask('foo') {
// ...so it is possible to use FTP task later without manual
installation
ant.ftp(server: 'ftp.foo.com', remotedir: 'www/foo', userid:
'foo.com', password: 'foo') {
fileset(dir: 'foo')
}
}
My look to documentation of the Gradle API does not give me any
solution how to set this type of dependency and I am stuck. All
attempts of setting dependency fails with Cause: the class
org.apache.tools.ant.taskdefs.optional.net.FTP was not found. Any
ideas how to solve this issue?
Gradle is shipped with the ant-nodeps jar. So you can easily use the
ftp task:
dependencies {
addMavenRepo()
addConfiguration('ftpAntTask')
ftpAntTask "org.apache.ant:ant-commons-net:1.7.0"
}
ant {
taskdef(name: 'ftp',
classname:
'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: dependencies.antpath('ftpAntTask'))
ftp(<args>) {
...
}
}
It is one of our aims for the next versions to make Gradle more
modular. So that you can for example use any version of Ant. Right now
you have to stick with Ant-1.7.0.
- Hans
--
Hans Dockter
Gradle Project lead
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email