如何在Intellij中将Gradle bootRun与--args一起使用 [英] How do I use Gradle bootRun with --args in Intellij

查看:385
本文介绍了如何在Intellij中将Gradle bootRun与--args一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gradle 4.9在bootRun中引入了--args参数,我可以从命令行轻松使用它,但是如何在Intellij 2018的运行/调试"配置中使用它呢?

Gradle 4.9 introduced the --args parameter to bootRun, which I can use easily from the command-line, but how do I use this from a Run/Debug configuration in Intellij 2018?

在Gradle版本中设置为在Intellij中的项目上运行bootRun任务后,我在运行/调试配置"屏幕中尝试了以下参数,但没有成功:

With a Gradle build set to run the bootRun task on my project in Intellij, I've tried the following arguments in the Run/Debug Configurations screen without any success:

  • --args 'foo'
  • --args='foo'
  • --args=foo
  • --args 'foo'
  • --args='foo'
  • --args=foo

Intellij的输出:

Output from Intellij:

9:18:56 AM: Executing task 'bootRun --args='foo''...

Unknown command-line option '--args'.
9:18:57 AM: Task execution finished 'bootRun --args='foo''.

类似的问题记录了执行此操作的旧语法.

推荐答案

也许您可以在IDEA的Run/Debug Configurations中以bootRun --args='foo'的形式将args添加到Tasks.

Maybe you can add your args to Tasks as bootRun --args='foo' in IDEA's Run/Debug Configurations.

我的任务是run --args='-h',它对我有用

My task is run --args='-h' and it works for me

这篇关于如何在Intellij中将Gradle bootRun与--args一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆