【问题标题】:Stop showing Welcome to Gradle message from output停止显示来自输出的 Welcome to Gradle 消息
【发布时间】:2016-09-05 17:44:42
【问题描述】:

我正在从命令行运行 gradle 命令,我只想显示输出。有一个选项 -q, -quiet 表示它只会记录错误。运行命令后,我也得到了这个带有输出的废话。我怎么能阻止这个?

Welcome to Gradle 2.11.

To run a build, run gradle <task> ...

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

To see more detail about a task, run gradle help --task <task>

【问题讨论】:

  • 你使用的是什么 gradle 版本?我正在运行 2.12,我看到的唯一输出是我们的测试写出的东西——没有任何 Gradle 消息。冉:“./gradlew -q clean build”
  • 有趣的是,我刚刚运行时确实看到了您正在谈论的消息:“./gradlew -q”没有指定任务。
  • 我正在使用任务运行它,但仍然收到相同的消息。
  • 嗯...我刚刚尝试了 2.9,但消息仍然被抑制。你能分享你正在运行的实际命令行吗?当您使用任务运行它时,它会运行该任务吗?
  • 我有一个任务是创建当前文件夹的 Zip 存档。它工作正常,即创建 zip

标签: gradle gradle-task


【解决方案1】:

解决方法,您可以在运行命令之前先运行gradle --version

例子:

gradle --version # the welcome message will appear here
gradle -q mycommand # there should be no welcome message anymore

编辑: gradle github 问题的解决方法:https://github.com/gradle/gradle/issues/5213#issuecomment-391976595

【讨论】:

    【解决方案2】:

    这可以在文件gradle.properties中配置:

    systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-01
      • 2023-04-07
      • 2019-10-17
      • 2018-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-13
      相关资源
      最近更新 更多