如何在Intellij中将Gradle bootRun与--args一起使用 [英] How do I use Gradle bootRun with --args in Intellij
问题描述
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屋!