Exec Task v project.exec difference in behaviour


(Schalk Cronjé) #1

Is this difference between Exec Task and project.exec expected behaviour in Gradle 1.6 or a bug?

// Works fine
task exec1 ( type : Exec ) {
  executable 'prog1'
  ignoreExitValue true
}
  // Fails to compile, complaining about ignoreExitValue
task exec2 << {
  exec {
    executable 'prog1'
    ignoreExitValue true
  }
}

As far as I understood project.exec had the same semantics as the Exec Task.


(Peter Niederwieser) #2

It’s ‘ignoreExitValue = true’. For tasks it’s oftentimes possible to omit the ‘=’.

PS: Please always provide the exact error message and stack trace.


(Schalk Cronjé) #3

@Peter,

Is there a technical limitation to why the interface cannot be consistent?


(Peter Niederwieser) #4

Task classes are generically enhanced at runtime (via code generation) for several reasons. There is no such mechanism for methods.


(Luke Daley) #5

This can be fixed, I raised GRADLE-2813 for this.


(Luke Daley) #6

This is fixed in 1.7.