我对groovy/gradle不熟悉
据我所知,Gealth/Groovy与Java兼容。
我在“build.gradle”文件中编写了以下Gradle(没有任何任务):
def myFun = {->"Hello World"}
class MyClass {
String getLabel() {
return ""+ myFun();
}
}
System.err.println(new MyClass().getLabel());
在哪里上课
MyClass
调用“全局”(?)功能
myFun
.
打电话
gradle --tasks
产生以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'build.gradle' line: 6
* What went wrong:
A problem occurred evaluating root project 'tmp'.
> No signature of method: MyClass.myFun() is applicable for argument types: () values: []
Possible solutions: find(), find(groovy.lang.Closure), wait(), any(), every(), dump()
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.671 secs
我怎么上这个课
类名
“查看”功能
MyFun
?
谢谢您。