intellij 是否支持启动配置中的变量?
在 Eclipse 中,我可以在启动配置中的 vm args 或程序 args 中包含类似以下内容:
-Dsome.system.property=${string.prompt:explanation:default}
当您运行此命令时,您会在一个小弹出窗口中收到一个字符串提示,显示说明文本并准备好默认值,它允许您每次运行应用程序时轻松注入属性。
我经常使用它来指定我是否想要应用程序的开发实例或测试实例。您还可以执行 ${env_var:ENVIRONMENT_VARIABLE_NAME}
来获取特定于计算机的配置,这对于在开发人员之间共享这些启动配置很有用。
IntelliJ Idea 是否支持此功能或类似功能?有提供此功能的插件吗?
In eclipse I can include things like the following in the vm args or program args in a launch configuration:
-Dsome.system.property=${string.prompt:explanation:default}
When you run this, you get a string prompt in a little pop up showing the explanation text and ready with the default, and it allows you to inject properties easily and per run of the application.
I use it a lot for things like specifying whether I want a dev or test instance of the application. You can also do ${env_var:ENVIRONMENT_VARIABLE_NAME}
to pick up machine specific config, useful for sharing these launch configs between developers.
Is this, or anything similar, supported in IntelliJ Idea? Are there plugins that provide this functionality?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
IntelliJ 中没有直接等效的东西。为了更轻松地在多个开发人员之间共享配置或其他项目设置,您可以使用路径变量(设置 | 路径变量,请参阅帮助以获取更多信息)。要在启动运行配置之前自定义选项,请在运行配置设置中启用“启动前|显示设置”选项。
There is no direct equivalent in IntelliJ. To make it easier to share configurations or other project settings between multiple developers, you can use path variables (Settings | Path Variables, see the Help for more information). To customize the options before launching the run configuration, enable the "Before launch | Show Settings" option in the run configuration settings.
至少在 IntelliJ 2016 版本中,您可以使用大括号括起来的环境变量语法访问环境变量:
已正确扩展,但替代语法
不起作用。
版本信息:
In the 2016 version of IntelliJ at least, you can access environment variables using the brace-enclosed environment variable syntax:
is expanded properly, but the alternative syntax
does not work.
Version Info:
刚刚在 IntelliJ 11.0.2 中对机器特定变量执行了此操作。
设置路径变量,即 MY_VARIABLE。
像在 eclipse 中一样在运行配置中使用:${MY_VARIABLE}
Just did this for a machine specific variable in IntelliJ 11.0.2.
Set up a path variable i.e. MY_VARIABLE.
Use in your run config as you would in eclipse : ${MY_VARIABLE}
在使用 IntelliJ IDEA 的这些年里,我从未见过这样的事情。
您可以在他们的问题跟踪器中提出功能请求,也许他们将来会实现它发布。
I've never seen anything like that in all my years using IntelliJ IDEA.
You can open a feature request in their issue tracker, and maybe they'll implement it in a future release.
也许这就是你想要的。这是我的项目的工作。
例如
Maybe this is what you want. it's work on mine project.
e.g.