【发布时间】:2016-01-13 12:07:08
【问题描述】:
当命令更新文本时,某些 Gradle Exec 任务会产生过多的输出。
当从终端运行时,这些命令会产生几行更新的输出。
当从 Gradle 中运行时,它们会在每次更新某些内容时产生一个新的输出行,例如:
docker 构建:
task dockerBuild(type: Exec) {
commandLine 'docker', 'build', '-t', 'foo', '.'
}
运行时产生:
Sending build context to Docker daemon 557.1 kB
Sending build context to Docker daemon 1.114 MB
Sending build context to Docker daemon 1.646 MB
Sending build context to Docker daemon 2.17 MB
Sending build context to Docker daemon 2.72 MB
Sending build context to Docker daemon 3.277 MB
Sending build context to Docker daemon 3.834 MB
Sending build context to Docker daemon 4.391 MB
... hundreds more lines ...
wget:
task fetchData(type: Exec) {
commandLine 'wget', 'http://example.org/some/large/file'
}
运行时输出:
HTTP request sent, awaiting response... 200 OK
Length: 209715200 (200M) [application/zip]
Saving to: '200MB.zip'
0K .......... .......... .......... .......... .......... 0% 5.02M 40s
50K .......... .......... .......... .......... .......... 0% 6.34M 36s
100K .......... .......... .......... .......... .......... 0% 6.68M 34s
150K .......... .......... .......... .......... .......... 0% 6.42M 33s
200K .......... .......... .......... .......... .......... 0% 6.41M 33s
250K .......... .......... .......... .......... .......... 0% 7.12M 32s
... thousands more lines ...
这是我可以在 Gradle 中解决的任何问题(例如,要求它在非交互模式下执行命令),还是由单个应用程序提供标志以禁用此类输出?
【问题讨论】: