I would move this buildscript block up to the top of the file and then have all the "apply plugin" statements follow it.