Refactor setting of latestHead/latestBranch flags.
Update to Grails 2.2.1; improve BuildConfig.