I think you'd use the standard Groovy way, right? println System.getenv()['JAVA_HOME']
Should work within the script. It works in mine. -- Hamlet D'Arcy [email protected] > -----Original Message----- > From: Les Hazlewood [mailto:[email protected]] > Sent: Monday, December 29, 2008 11:58 AM > To: [email protected] > Subject: [gradle-user] Gradle easy access to environment variables > > 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 > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
