# Is there a way to read the gradle.properties in the buildscript closure?

**URL:** <https://discuss.gradle.org/t/is-there-a-way-to-read-the-gradle-properties-in-the-buildscript-closure/4042>\
**Category:** Old Forum Archive\
**Created:** [August 1, 2014, 3:34pm UTC](https://discuss.gradle.org/t/is-there-a-way-to-read-the-gradle-properties-in-the-buildscript-closure/4042 "2014-08-01T15:34:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason2](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Jason2](https://discuss.gradle.org/u/Jason2)\
**Post date:** [August 1, 2014, 3:34pm UTC](https://discuss.gradle.org/t/is-there-a-way-to-read-the-gradle-properties-in-the-buildscript-closure/4042/1 "2014-08-01T15:34:00Z")

</div>

I have a subproject that has a buildscript that does the following:

```gradle
project.buildscript { scriptHandler ->
    // configure the repositories
    apply from: "${rootDir}/gradle/repositories.gradle", to: scriptHandler
}

```

the repositories.gradle file has a variable in it similiar to the following:

```gradle
def contextUrl = hasProperty('contextUrl') ?
                              contextUrl :
                             defaultContextUrl

```

The defaultContextUrl is located in the root projects gradle.properties file. When I try to do a clean I get the following error:

```gradle
No such property: defaultContextUrl for class: org.gradle.api.internal.initialization.DefaultScriptHandler

```

---

<div class="post-metadata">

**Author:** ![Jason2](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Jason2](https://discuss.gradle.org/u/Jason2)\
**Post date:** [August 1, 2014, 3:35pm UTC](https://discuss.gradle.org/t/is-there-a-way-to-read-the-gradle-properties-in-the-buildscript-closure/4042/2 "2014-08-01T15:35:00Z")

</div>

I would like to make the variable configurable
