Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting environment variables from Gradle

I need to execute from Gradle an Ant script which relies on environment variables. Ant uses <property environment="env"/> for it.

I tried to do env.foo="bar" in Gradle, but it throws a Groovy exception.

What is the proper way to pass environment variables from Gradle to Ant?

like image 528
Sergey Avatar asked Jan 09 '12 13:01

Sergey


People also ask

How do I set environment variables in Gradle Windows 10?

In File Explorer right-click on the This PC (or Computer ) icon, then click Properties -> Advanced System Settings -> Environmental Variables . Under System Variables select Path , then click Edit . Add an entry for C:\Gradle\gradle-7.5.1\bin . Click OK to save.


1 Answers

From the gradle 2.0 docs, i see something like this is possible

test {
  environment "LD_LIBRARY_PATH", "lib"
}

Or in this case could use this

systemProperty "java.library.path", "lib"
like image 50
dre Avatar answered Oct 21 '22 04:10

dre