Gradle:No signature of method: static Script1.main() is applicable for argument types
Gradle4.*で使用していたスクリプトをGradle5.5で使おうとして、エラーになった。
* What went wrong:
A problem occurred evaluating root project '....'.
> No signature of method: static Script1.main() is applicable for argument types: (Script1$_run_closure1$_closure2) values: [Script1$_run_closure1$_closure2@39ecc871]
Possible solutions: main([Ljava.lang.String;), wait(), wait(long), run(), run(), any()
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
処理内容は以下で、「gradle cleanEclipse eclipse」とした。Gradle4.*では動作していたものだ。
apply plugin: 'java'
apply plugin: 'eclipse'
def s = """x.sourceSets {
main {
java {
srcDir 'src'; exclude('**/*Test.java')
}
resources {
srcDir 'src'; exclude('**/*Test.java')
}
}
}"""
Eval.x(project, s)
かなり悩んだのだが、一点だけ修正すれば動作する。なぜここだけ必要なのかはさっぱりわからない。
apply plugin: 'java'
apply plugin: 'eclipse'
def s = """x.sourceSets {
delegate.main { // <------ delegate.をつける
java {
srcDir 'src'; exclude('**/*Test.java')
}
resources {
srcDir 'src'; exclude('**/*Test.java')
}
}
}"""
Eval.x(project, s)
なぜmainは必要で、javaやresourcesは不要なのだろうか???
ディスカッション
コメント一覧
まだ、コメントがありません