Can't use task with name 'package'?


(Jamie Olson) #1

In a project with the java plugin, this works to create a dummy task for consistency with the other projects in a multi-project build:

task pack(dependsOn: jar) << {
  println "dummy task"
}

But if I name the task ‘package’:

task pack(dependsOn: jar) << {
  println "dummy task"
}

I get: expecting EOF, found ‘package’ @ line 7, column 6.

task package << {


(Peter Niederwieser) #2

‘package’ is a keyword in Groovy. You can always do:

task(“package”, dependsOn: Jar) { … }