On 20/01/2011, at 8:09 PM, Matthias wrote:

> Hi,
> 
> I'm struggling to get ant.apply actually work in my build script.
> I'm fairly new to Gradle so please bear
> with me, maybe I'm just missing something really obvious.
> 
> Just for toying around, I wanted to start simple and invoke the 'ls' command
> (I realize Ant has
> built-in functions for file listings, but anyway), so what I did is this:
> 
> task antTest << {
>    ant.apply(executable: '/bin/ls') {
>        arg(value: '-l')
>    }
> }

Why not use the Gradle Exec task?

task doStuff(type: Exec) {
    commandLine = ['/bin/ls', '-l']
}

Have a look at the documentation for the Exec task for more details: 
http://gradle.org/0.9.1/docs/dsl/org.gradle.api.tasks.Exec.html


> 
> $gradle antTest
> 
> Execution failed for task ':antTest'.
> Cause: no resources specified
> 
> What is that supposed to mean? What resources would I have to supply to
> the 'ls' command? According to the official docs, the executable name is
> the only required argument for apply.

These are probably questions for the Ant developers. I would guess that the Ant 
apply task is expecting that you specify least one non-empty set of resources, 
ie you need a nested fileset() element, or some other Ant resource collection: 
http://ant.apache.org/manual/Types/resources.html#collection


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to