Why isn't ext property visible in buildscript block immediately after assignment?

I went to update an old plugin of mine to make it compatible with 2.x but ran into problem. Regression testing shows that this problem popped up with Gradle 1.11. Release notes for 1.11 show nothing relevant (the release seems targeted mostly for native compilation enhancements).

buildscript {

ext.cpFileTree = fileTree(

dir: ‘build/libs’,

excludes: [’-sources.jar’, '-javadoc.jar’],

include: ‘gradle-javaPropFile-plugin-*.jar’


dependencies { classpath ext.cpFileTree }


The assignment definitely executes before the abortion because I can insert a print of ext.cpFileTree immediately before the dependencies line and it does print out the correct ext.cpFileTree before aborting on the dependencies line. Line 36 referenced below is the dependencies line above.

FAILURE: Build failed with an exception.

  • Where:

Build file ‘/home/blaine/gradle/gradle-javaPropFile-plugin/build-dist.gradle’ line: 36

  • What went wrong:

A problem occurred evaluating root project ‘gradle-javaPropFile-plugin’.

cannot get property ‘cpFileTree’ on extra properties extension as it does not exist

The problem is that the ‘dependencies {}’ block got its own ‘ext.’ space in 1.11. It wasn’t considered ahead of time that this would break.


  1. Change ‘classpath ext.cpFileTree’ to ‘classpath cpFileTree’ 2. Change ‘classpath ext.cpFileTree’ to ‘classpath buildscript.ext.cpFileTree’

That worked.

Thanks very much.