I have a feeling the Immo’s second solution will have the same issue as the OP’s; the project properties will not be available. I’d really like to separate the buildscript block into a reusable file.
Better yet I’d like an easy way to reuse gradle scripts over different projects as we have many builds that are basically just copy after copy of the same or very similar gradle files… I prefer scripts to plugins as the DSL is familiar and more clear to me.
I’ve packaged up scripts into a commonBuild.jar and then the buildscript grabs that file from an enterprise Ivy repo and then I can apply files from the commonBuild.jar, but it still feels harder / messier than it should be.