I have the following task definition:
task small(dependsOn: configurations.compile) << {
def command = [“${projectDir}/setter-for-catan.scala”]
def env = null //
println ([‘echo’, ‘********************** 0’].execute(env, null).text)
println (command.execute(env, null).text)
}
The contents of the Scala script is:
#!/bin/bash
echo ‘********************* 1’ “$0” “$@”
/opt/scala-2.10.1/bin/scala “$0” “$@” 2>&1
!#
object ‘setter-for-catan’ {
def main(args: Array[String]) {
println(“****************** 2”)
}
}
This gives the following output:
$ g small
:small
********************** 0
********************* 1 /Users/nyap/proj/setter-for-catan/setter-for-catan.scala
****************** 2
BUILD SUCCESSFUL
If ‘env’ is defined as ‘’, Gradle hangs with the following output:
$ g small
:small
********************** 0
Building > :small
If ‘“$0” “$@”’ is then changed to ‘-version’, the build stops hanging with the following output:
$ g small
:small
********************** 0
********************* 1 /Users/nyap/proj/setter-for-catan/setter-for-catan.scala
Scala code runner version 2.10.1 – Copyright 2002-2013, LAMP/EPFL
BUILD SUCCESSFUL
What’s going on? Should I ask a Groovy community instead?