It is not readily apparent to me in the User Guide (Section 4.3) how to
quickly reference environment variables in Gradle scripts.

I do not want to create environment variables ORG_GRADLE_PROJECT_propName
since I'm trying to support an existing build where environment variables
are already set on many machines.

So far, I found I can do the following:

createTask("init", overwrite: true) { task ->
   ant.property(environment: "env");
   println ant.antProject.properties["env.MY_ENV_VAR"]
}

However, that seems a little hacky.  I was assuming that there was a nicer
way to do this in Gradle automatically, for example, envProps.MY_ENV_VAR.

Can someone please clarify?

Thanks,

Les

Reply via email to