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
Just test the existence of buildScan
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
}
This might not be a good or proper solution, but here's one workaround: use a try
/catch
to swallow the error, something like:
try {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
} catch (MissingMethodException e){
// This isn't the exception you're looking for
}