Thanks Szczepan and Hans for your responses and help.

Best regards,

Ales



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

Hi,

I'm not an expert so either I'm gonna confuse you or actually help  :) 

Gradle speaks ant natively so you can declare custom ant tasks exactly
the same you do with plain ant files (was it <taskdef/> ?). Obviously
your suggestion is more elegant but I'm just saying that it should be
possible to use extra ant tasks without hacking GRADLE_HOME/lib on
every machine.

Cheers,
Szczepan Faber
  

ales  wrote / napísal(a):
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?

Best regards,

Ales
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to