Apply build-scan plugin in init.gradle

plugins

(Tony Robalik) #1

To summarize my question: what is the fully-qualified name of the build-scan plugin? See below for context:

I would like to apply the build-scan plugin in my init.gradle in $HOME/.gradle/init.d/init.gradle. I was able to do this with buildReceipt with the following script:

initscript {
    repositories {
	maven { url "https://plugins.gradle.org/m2" }
    }
    dependencies {
	classpath 'com.gradle:build-receipt-plugin:1.2'
    }
}
rootProject {
    apply plugin: com.gradle.receipts.plugin.BuildReceiptPlugin
    buildReceiptLicense {
        agreementUrl = "https://gradle.com/terms-of-service"
        agree = "yes"
    }
}

I actually don’t recollect how I found the fully-qualified name of the build receipt plugin, and a quick search online hasn’t yet helped. I tried using the new plugins { } mechanism, but got the following error:

Error:Gradle DSL method not found: 'plugins()'

So I assume I need the fully-qualified name of the build-scan plugin. What is it?


(Etienne Studer) #2

Hi Tony

You can find some references regarding version numbers and naming here:
https://scans.gradle.com/setup/step-1
https://plugins.gradle.org/plugin/com.gradle.build-scan

Note that very soon we will re-add the documentation that shows how to apply the build-scan plugin from an init script.

Regards, Etienne


(Tony Robalik) #3

Thanks, Etienne. I look forward to seeing those init script instructions.


(Tony Robalik) #4

@etiennestuder, any word on documentation on applying the build-scan plugin from an init script?


(Etienne Studer) #5

Yes, we have updated the onboarding pages accordingly, and the production upgrade of those pages will go live this week. We will let you know on this thread when it has been done.


(François Guillot) #6

Hey,

The production upgrade is done.
You can now find an exemple init script in https://scans.gradle.com/setup/step-1, by clicking on the Don't want to modify your build file? link at the bottom right of the page.

Cheers,

François


(Tony Robalik) #7

Thank you. Works perfectly.


(Tony Robalik) #8

@Francois_Guillot or @etiennestuder, is there a way to specify -Dscan in my gradle.properties file so it runs by default? I’m derping hard on this one. It’s not obvious from the docs here. Thanks.


(François Guillot) #9

Hi @trobalik

This is not possible. We explicitly check for the system property on the command line.
This is not definitive, and their will be some changes about that in the near future .

Stay tuned :slight_smile:


(Tony Robalik) #10

Understood. Thanks much.