Adding an action to task.actions results in exception


(Robert Kühne) #1

Following did work with gradle 1.5:

task hello << {
 println "Some action"
}
  hello.actions.add(0, ({ t ->
    println "In between"
} as Action))

But in gradle 1.6 this results in an exception: https://gist.github.com/sponiro/5553151


(Luke Daley) #2

Thank you very much for the report.

Raised as GRADLE-2774.

As a workaround, you should use the ‘doFirst()’ or ‘doLast()’ methods.


(Robert Kühne) #3

I was not using this in production but just playing around. Till now I had no need to add actions this way. ‘doFirst()’ and ‘doLast()’ were sufficient so far.