IntelliJ Not Picking Up System Environment Variable

Hello,

I set a system environment variable, I rebooted, I copied and pasted the variable from the IntelliJ editor into cmd and checked the output with "echo %uprr.implementation.environment%". echo returns the correct value ("local" for anyone curious).

And yet... for some reason.... IntelliJ is not picking up this variable. The variable is a system variable, not a user (I had to call a special person to log in as an admin and set the variable for me, so I know it's not a user variable).

Any ideas are welcome. Here's a screenshot of my Spring file clearly indicating that the variable is unknown.

spring-property.PNG

Thanks for any and all help.

David Zemon

1 comment

IntelliJ IDEA does not resolve Spring placeholders against System Environment Variables (see http://youtrack.jetbrains.com/issue/IDEA-55706). You have two options.

The first option is to suppress the warning by typing Alt+Enter, Selecting "Add Property", hit the right arrow key, and select suppress for tag. This will eliminate the warning.

The second option is to set up a stand-in property. An advantage of this option is that if other properties or values are based on the "missing" system property, you will still see them resolved properly. Create a properties file in your project's root directory (or elsewhere.) We have a standard name of "runtime.properties" for such a file and have "runtime.properties" in our version control ignore list so it never gets committed. Each developer can then set these as desired. You may want to adopt a similar strategy. In the properties file, define the property that is otherwise defined in your system properties. (you can even just set it to nothing: uprr.implementation.environment= ). Now in your Spring Facet configuration, add the properties file to your Application Context definition. Select the definition, click the edit button, and then in the "Edit Application Context" dialog, click the add button and select "Additional Property Files".  See "Managing Spring Configuration Files" in help guide if you are unfamiliar with such.

0

Please sign in to leave a comment.