# MissingPropertyException thrown for extended properties used in build/dependencies section of build.gradle

**URL:** <https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103>\
**Category:** Old Forum Archive\
**Created:** [January 17, 2015, 5:10am UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103 "2015-01-17T05:10:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![samrocketman](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/samrocketman/32/362_2.png) [@samrocketman](https://discuss.gradle.org/u/samrocketman)\
**Post date:** [January 17, 2015, 5:10am UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/1 "2015-01-17T05:10:00Z")

</div>

Here’s a test case build.gradle file.

[https://gist.github.com/samrocketman/06d4cfc37e1e1c453db5](https://gist.github.com/samrocketman/06d4cfc37e1e1c453db5)

If you uncomment line 9 then gradle throws a MissingPropertyException. I’ve included a wrapper section so that it is easy to test against the latest stable gradle 2.2.1.

‘’’ gradle wrapper ./gradlew assemble ‘’’

Then after uncommenting line 9 in the test case.

‘’’ ./gradlew assemble --stacktrace ‘’’

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [January 17, 2015, 7:19pm UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/2 "2015-01-17T19:19:00Z")

</div>

The reason for this is because the ‘buildscript {…}’ block is evaluated before your project so that property does not yet exist. If you want to use properties within a ‘buildscript {…}’ block you will have to specify the properties on the CLI using ‘-Dprop=value’ or in a _gradle.properties_ file.

---

<div class="post-metadata">

**Author:** ![samrocketman](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/samrocketman/32/362_2.png) [@samrocketman](https://discuss.gradle.org/u/samrocketman)\
**Post date:** [January 17, 2015, 8:21pm UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/3 "2015-01-17T20:21:00Z")

</div>

Then I would at the very least consider it a documentation bug. Because the extended property documentation makes no mention of the exception you just mentioned. It claims that you set the property and can just use it where-ever. It took me a few weeks to figure out it was this strange case as you mention with some help in the IRC channel towards the end of my debugging.

---

<div class="post-metadata">

**Author:** ![samrocketman](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/samrocketman/32/362_2.png) [@samrocketman](https://discuss.gradle.org/u/samrocketman)\
**Post date:** [January 18, 2015, 6:13pm UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/4 "2015-01-18T18:13:00Z")

</div>

For reference, I’m using this way to test against multiple versions of groovy in my project [https://github.com/samrocketman/jervis/blob/master/build.gradle](https://github.com/samrocketman/jervis/blob/master/build.gradle)

---

<div class="post-metadata">

**Author:** ![Jose\_J\_Rubalcaba](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@Jose\_J\_Rubalcaba](https://discuss.gradle.org/u/Jose_J_Rubalcaba)\
**Post date:** [January 18, 2015, 7:41pm UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/5 "2015-01-18T19:41:00Z")

</div>

hffg

---

<div class="post-metadata">

**Author:** ![Jose\_J\_Rubalcaba](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@Jose\_J\_Rubalcaba](https://discuss.gradle.org/u/Jose_J_Rubalcaba)\
**Post date:** [January 18, 2015, 7:42pm UTC](https://discuss.gradle.org/t/missingpropertyexception-thrown-for-extended-properties-used-in-build-dependencies-section-of-build-gradle/2103/6 "2015-01-18T19:42:00Z")

</div>

h
