if (!project.hasProperty("rootBuildDirectory")) { throw new GradleException('Please ensure the "rootBuildDirectory" property is defined before applying this script.') } ext.distDir = file("$rootBuildDirectory/dist") def rootProperties = new Properties() def rootDir = file(rootBuildDirectory).absolutePath file("$rootDir/gradle.properties").withReader { rootProperties.load(it) } rootProperties.each { k, v -> if (!project.hasProperty(k)) { ext.set(k, v) } }