If you change your build.gradle to simply be
task hello << {
def utils = new Utils()
utils.doit();
}
Then instead of
test
-> groovy
-> Utils.groovy
-> build.gradle
move the Utils.groovy
file to buildSrc/src/main/groovy
like so:
test
-> buildSrc
-> src
-> main
-> groovy
-> Utils.groovy
-> build.gradle
and gradle should pick it up automatically...
//=================
所以缺省的约定是Groovy脚本应放在buildSrc/main/src/groovy下面