ich ausführen möchten einen Befehl von der Kommandozeile in gradle Aufgabe (. Z drucken Sie alle Dateien in dir):Gradle, Task-Typ: Exec - command nicht funktionieren in onLast
task dir(type: Exec) {
def adbCommand = ["dir", "*.*"]
commandLine adbCommand
standardOutput = new ByteArrayOutputStream()
doLast {
println ("result = " + standardOutput)
}
}
Es ist Arbeit. OK. Aber wenn ich es auf onLast
Abschnitt arbeitet es nicht:
task dir(type: Exec) {
doLast {
def adbCommand = ["dir", "*.*"]
commandLine adbCommand
standardOutput = new ByteArrayOutputStream()
println ("result = " + standardOutput)
}
}
ich Fehler:
AUSFALL: mit einer Ausnahme fehlgeschlagen bauen.
- Was schief gelaufen ist:
Ausführung für Aufgabe fehlgeschlagen ': App: dir'.
execCommand == null!
Mögliches Duplikat von [Gradle, Befehlszeile 'cmd', '/ c', 'echo doLast!' macht nichts] (http://stackoverflow.com/questions/42055620/gradle-commandline-cmd-c-echo-dolast-does-nothing) – sm4