Groovy Class takes Environment variables first time correct and for the second time it uses (most likely from buildCache).Without gradle daemon everything works fine.
This problem appeared in Gradle 3.5.
GradleBug.zip (1.6 KB)
env.bat just sets up the Location (Java and Gradle).
TestCase.bat just run 4 times the same Gradle build file.
runBuild.bat runs gradle file with daemon and takes 1 Parameter (just a string e.g.: ‘ABC’)
runBuild-no-daemon.bat runs gradle file without daemon and takes 1 Parameter (just a string e.g.: ‘FGH’)
build.gradle creates a floder, but also prints out the Paramter.
The second run of runBuild.bat (“runBuild.bat XYZ”) shows the Problem.