In Eclipse you could set the -D options to include {} variables that were defined elsewhere within your IDE settings. IntelliJ would seem to provide this feature with Path Variables. However, if you follow their Help documents, you're supposed to be able to reference these variables between $dollar_characters$. Further research would seem to indicate that that only applies to the interior of your project files and the replacement is done during build time.
I'm trying to create a shared server configuration where a couple of the system properties can be swapped out by the other developers, but this one has me stumped.
You can directly set your VM options on the Tomcat Server Run/Debug configuration window by adding it to the VM Options input field. You can directly put in your -Dcustom_property=value
into that field and then access it through System.getProperty("customer_property")
.
After much digging and research into seemingly unrelated issues, I began to get a larger picture of how to accomplish this:
-Dsystem.property="variable here"
) in the VM options field of your configuration..idea/runConfigurations
and replaces the stubs with $PATH_VARIABLE$
, placing them inside of quotes if the value will include spaces.Note: It may seem like you ought to be able to put those $PATH_VARIABLES$
directly into those config screens, but it only seems to work if you've edited the XML files directly.
Joel Wilson, thanks for your exploration on using $PATH_VARIABLES$ in IntelliJ Configurations.
To embellish your finding a bit; I found out that if a config file changes at the file system it gets reloaded by IJ right then ($PATH_VARIABLES$ get expanded). However if you make the change in IJ Preferences it doesn't.
But if you: touch ~/IntelliJ/yourProject/.idea/runConfigurations *.xml
That is enough to have your configurations reloaded.
I also found out that if you close and reopen IJ, that these will be autoexpanded at that time too.
And if you look at those .xml files, the expanded values don't ever get stored. The expansion happens any time you load IJ, or change the files.
Bottom line if you want to share common configurations in a repo - and then setup the user variable stuff in IJ PATH variables - you can and they will be automatically expanded.
If you happen to change the PATH variables, the new values will contain the modified PATH_VARIABLE content.
If you were to look at the files at OS level, you'll see the variables preserved. But if you look in the Configuration editor, the substituted values will always show there (so you can't directly see that they used a variable). Best to look at the OS file for that. jim
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