title: Is there a way to pass current BUILD_NUMBER to Gradle deamon from Jenkins build?
body: <p>I am accessing Jenkins build number in Gradle script by calling: </p>
  
  <pre><code>def buildNumber = System..getenv('BUILD_NUMBER')
  </code></pre>
  
  <p>It works fine the first time I run the build. The second time the build is run, the number is not incremented, it stays the same from previous build run.
  I am using 4.4.1 version of Gradle. I don't remember having the same problem with earlier versions.</p>
  
  <p>My current workaround is to pass --no-daemon switch to Gradle. However, that way I am not able to benefit from daemon feature. Is there a way to use daemons ans still get the correct build number in Gradle build?</p>