当前位置: 动力学知识库 > 问答 > 编程问答 >

java - does intellij support variables in launch configurations?

问题描述:

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?

网友答案:

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.

网友答案:

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}

网友答案:

In the 2016 version of IntelliJ at least, you can access environment variables using the brace-enclosed environment variable syntax:

${HOME}/path/to/file

is expanded properly, but the alternative syntax

$HOME/path/to/file

does not work.

Version Info:

IntelliJ IDEA 2016.2.2
Build #IC-162.1628.40, built on August 16, 2016
JRE: 1.8.0_76-release-b216 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
网友答案:

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.

launchctl setenv ANDROID_HOME= /usr/myuser/android_sdk/
and restart intellij
分享给朋友:
您可能感兴趣的文章:
随机阅读: