2
我有以下項目結構:如何在Gradle中執行任務?
- 應用
- 的build.gradle
- 的build.gradle
- settings.gradle
應用/的build.gradle :
apply plugin: 'java'
settings.gradle:
include ':application'
的build.gradle:
task custom << {
project.tasks.getByName("build").execute()
}
所以我想執行任務的 「構建」 內部任務 「自定義」。 但是當我運行「gradle這個定製」的結果是:
:custom FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/tmp/test/build.gradle' line: 3
* What went wrong:
Execution failed for task ':custom'.
> Task with name 'build' not found in root project 'test'.
* 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: 1.183 secs
如何我可以執行「構建」內部任務「定製」的任務嗎?