On 27/03/2012, at 11:19 PM, Luke Daley wrote:
>
> 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"
> }
Or even just
task buildExplodedWar(type: Copy) {
from configurations.runtime
destination "$project.buildDir/war"
}
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com