title: How to set environment variables read in Intellij IDEA build.gradle?
body: <p>In my Intellij IDEA (v2017.1.5 , currently the latest) module build.gradle I need to read an OS (Linux) environment variable when I def a build-time variable based on that environment variable. Other than setting that environment variable in a parent shell to Intellij IDEA (eg. a wrapper shell script that sets the env var then calls idea.sh , or just in my login shell's .bashrc ), how do I set the env var scoped to just the single module, or just to the single IDEA project? Ideally if I open a Terminal from the IDEA project I'd be able to echo $PROJECT_VAR for the value.</p>
  
  <p>Setting variable values in the project's Run/Debug Configurations > Groovy > build > Environment variables or Settings > Appearance &amp; Behaviors > Path Variables didn't make the values accessible by build.gradle (or in the Terminal shell).</p>