我創建了一個非常簡單的gradle文件,其中包含一個名爲groovy的任務。簡單的groovy程序 - Gradle
task groovy << {}
println "Hello Groovy!"
我嘗試在cmd中我的項目的文件夾下運行它(我使用的是Windows 8.1)作爲
gradle groovy
,但我得到這個錯誤:
FAILURE: Build failed with an exception.
What went wrong:
Task 'groovy' not found in root project 'MyExercise'.
Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace
option
to get the stack trace. Run with --info or --debug option to get more log
output
它爲什麼不能找到時髦的任務?它在我的build.gradle
文件中聲明。 Gradle已安裝。這是我的版本。
Gradle 3.0
------------------------------------------------------------
Build time: 2016-08-15 13:15:01 UTC
Revision: ad76ba00f59ecb287bd3c037bd25fc3df13ca558
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_45 (Oracle Corporation 25.45-b02)
OS: Windows 8.1 6.3 amd64
和命令gradle這個任務說明:
All tasks runnable from root project
------------------------------------------------------------
Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared
t 'MyExercise'.
components - Displays the components produced by root project 'MyE
ubating]
dependencies - Displays all dependencies declared in root project
dependencyInsight - Displays the insight into a specific dependenc
ect 'MyExercise'.
help - Displays a help message.
model - Displays the configuration model of root project 'MyExerci
ng]
projects - Displays the sub-projects of root project 'MyExercise'.
properties - Displays the properties of root project 'MyExercise'.
tasks - Displays the tasks runnable from root project 'MyExercise'
To see all tasks and more detail, run gradle tasks --all
To see more detail about a task, run gradle help --task <task>
BUILD SUCCESSFUL
任何想法?
謝謝
Theo。
又是什麼'gradle這個tasks'告訴你? –
我把gradle任務的結果放在我的問題 – Theo
我想我應該看到像其他任務groovy類似的東西。但我不:( – Theo