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?
Add environment variablesFrom the main menu, select Run | Edit Configurations or choose Edit Configurations from the run/debug configurations selector on the toolbar. In the Run/Debug Configurations dialog, select a configuration you want to add the environment variables to.
Run/debug configurations IntelliJ IDEA uses run/debug configurations to run, debug, and test your code. Each configuration is a named set of startup properties that define what to execute and what parameters and environment should be used.
Click edit configurations on the dropdown box for your runtime configurations. Select the runtime you want to add environment variables to. Click environment variables folder icon to pull up the environment variables screen. From here you can add as many environment variables as you want.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With