title: How to access extra properties defined in build.gradle in a Groovy class?
body: <p>I am defining an extra property in build.gradle:</p>
  
  <pre><code>ext {
   GRGIT_TARGET_REPO = ...
  }
  </code></pre>
  
  <p>I have a groovy class under buildSrc/src/main/groovy</p>
  
  <pre><code>class Utils {
     def test() {
        println GRGIT_TARGET_REPO
     }
  }
  </code></pre>
  
  <p>I have another gradle file which can access GRGIT_TARGET_REPO just fine. But if it calls the function in the class:</p>
  
  <pre><code>Utils utils = new Utils()
  utils.test()
  </code></pre>
  
  <p>On calling the above function, I get the following error:</p>
  
  <p><code>No such property: GRGIT_TARGET_REPO for class: Utils</code></p>
  
  <p>Is there a way to access project/extra properties in Groovy classes?</p>