Use the build scan plugin within a Gradlle kotlin script

Hello,

I am testing the gradle script plugin.
In this script, I try to apply the build-scan plugin but with no success.
Fist I try to do something like that

plugins {
    id 'com.gradle.build-scan' version '1.6'
}

But with ne success.

Then, I try to apply this plugin by this way:

buildscript {
repositories {
maven {
setUrl(“https://plugins.gradle.org/m2/”)
}
}
dependencies {
classpath(“com.gradle:build-scan-plugin:1.6”)
}
}

apply {
plugin(“com.gradle.build-scan”)
plugin(“java”)
}

That work, but I don’t know hot to configure it. This not work with kotlin

buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service
licenseAgree = ‘yes’
}

Then I try to use configure, but I don’t know wich class to use_

configure<?> {
?
}

How can I configure the plugin ? Is there a better way to do that ?

Thanks

Hi,

Here’s the equivalent build-scan configuration in Kotlin:

// requires a `import com.gradle.scan.plugin.BuildScanExtension` at the top
configure<BuildScanExtension> {
    setLicenseAgreementUrl("https://gradle.com/terms-of-service")
    setLicenseAgree("yes")
}

For the record, here’s what it will look like in the upcoming version of Gradle Script Kotlin:

plugins {
    id("com.gradle.build-scan") version "1.6"
}

buildScan {
    setLicenseAgreementUrl("https://gradle.com/terms-of-service")
    setLicenseAgree("yes")
}

Cheers,
Rodrigo