I am using Gradle 4.6 which allows me to run build scans using the --scan option without having to explicitly apply or download extra plugins
--scan
Just test the existence of buildScan
buildScan
if (hasProperty('buildScan')) { buildScan { termsOfServiceUrl = 'https://gradle.com/terms-of-service' termsOfServiceAgree = 'yes' } }