Refreshing environment variables

Is there any way to get IntelliJ to refresh Windows environment variables, e.g. M2_HOME, JBOSS_HOME, etc from within Ant or Maven build files?

E.g. from Ant build.xml:
<property environment="osenv"/>
<property name="maven.home.bin" value="${osenv.M2_HOME}/bin" /

It seems that if you change any environment variable in the OS you need to restart IntelliJ for the new values to be refreshed in the scripts.

Comment actions Permalink

No, there is no way. Just like with any other Windows executable, system-level changes to the environment variables are only propagated to the process when it is restarted.

Comment actions Permalink

This is super old, but seeming still relevant.  I will be bold and say it is incorrect to state "there is no way".  If you can override env vars in run configs, then It should be totally doable.  This would make a great feature IMO.  Perhaps it's possible via a plugin as an alternative to an integrated feature.  I just did a quick search, but turned up nothing obvious.

Comment actions Permalink

There must be a way to do it, if when you first start pycharm or something similar it will load your system variables. So even if pycharm can't automatically detect that things have changed, there should be an option to reload this information.

Or does anyone know if there is now a plugin that does this


Please sign in to leave a comment.