Gradle 2.14-rc-3 throws MissingPropertyException for property set that worked previously

Appears to be another regression related to property access. This test fails, but worked in previous releases. Note that if I manually inline the setupProject method, the issue clears up:

import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Specification

class MissingPropertySpec extends Specification {
    static String mavenUrl

    Project project

    def setup() {
        mavenUrl = "http://someurl"
        project = ProjectBuilder.builder().build()
    }

    def 'test'() {
        expect:
        setupProject(project)
    }

    private static void setupProject(Project project) {
        project.apply plugin: JavaPlugin

        project.status = 'release'

        project.repositories {
            maven { url mavenUrl }
        }
    }
}

Failure:

groovy.lang.MissingPropertyException: Could not get unknown property 'mavenUrl' for object of type org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.

	at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:88)
	at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:62)
	at groovy.lang.Closure.getPropertyTryThese(Closure.java:324)
	at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:314)
	at groovy.lang.Closure.getProperty(Closure.java:299)
	at MissingPropertySpec.setupProject_closure1$_closure2(Test.groovy:27)
	at groovy.lang.Closure.call(Closure.java:426)
	at groovy.lang.Closure.call(Closure.java:442)
	at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
	at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:87)
	at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.maven(DefaultRepositoryHandler.java:89)
	at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.maven(DefaultRepositoryHandler.java:93)
	at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:371)
	at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:166)
	at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
	at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:29)
	at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
	at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:29)
	at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:59)
	at MissingPropertySpec.setupProject_closure1(Test.groovy:27)
	at groovy.lang.Closure.call(Closure.java:426)
	at groovy.lang.Closure.call(Closure.java:442)
	at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
	at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:136)
	at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:66)
	at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:33)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:103)
	at org.gradle.api.internal.project.AbstractProject.repositories(AbstractProject.java:903)
	at MissingPropertySpec.setupProject(Test.groovy:26)
	at MissingPropertySpec.test(Test.groovy:18)

Thanks. I’ve added GRADLE-3461 for this issue.