How to accept Gradle ToS for `build --scan` automatically and still manage to run build without a scan?

后端 未结 2 1118
小鲜肉
小鲜肉 2021-01-18 04:25

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

相关标签:
2条回答
  • 2021-01-18 04:52

    Just test the existence of buildScan

    if (hasProperty('buildScan')) {
        buildScan {
            termsOfServiceUrl = 'https://gradle.com/terms-of-service'
            termsOfServiceAgree = 'yes'
        }
    }
    
    0 讨论(0)
  • 2021-01-18 05:00

    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
    }
    
    0 讨论(0)
提交回复
热议问题