On 27/03/2012, at 1:12 PM, k4rn4k wrote:
> Hello,
>
> Im setting this task outputs like shown in the user guide, but It's always
> being resolved as "up to date as it has no source files".
>
> task buildExplodedWar(type: Copy)<<{
> //Configuring inputs/outputs
> destDir = new File ("$project.buildDir/war")
> project.configurations.runtime.each{srcFile ->
> inputs.file srcFile
> }
> outputs.dir destDir
> //Some copy behaviour
> }
The problem is that you are setting them during task execution.
You need to rewrite as this:
task configureBuildExplodedWar << {
project.configurations.runtime.each { srcFile ->
buildExplodedWar.from srcFile
}
}
task buildExplodedWar(type: Copy, dependsOn: configureBuildExplodedWar) {
destination "$project.buildDir/war"
}
That should be all you need.
This is somewhat of a general pattern for delaying task configuration until
execution, that we call “configuration tasks”.
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email