Gradle BuildScan Root Directory

I have something like the following.

buildscript {
    repositories {
        maven { url '' }
    dependencies {
        classpath 'com.gradle:build-scan-plugin:1.13.4'

apply plugin: ''

I get this error, below.

The build scan plugin can only be applied to the root project.

I have the build.gradle file in a buildSrc folder inside a sub folder.

My question is:
Is there a way to point to root project without moving the build.gradle file?

Thanks in advance!


The build scan plugin can indeed only be applied to the root project of your main build (not any buildSrc build, or any included build in a composite).

If you’re trying to collect buildSrc data in build scans, I have good news for you.

Starting today, when using version 1.14 of the build scan plugin, and Gradle 4.3+, you now have access to all the data coming from your buildSrc build in your build scans. Check this example build scan I just created.
You just need to apply the build scan plugin to the root project of the root build for this to happen.

Please get back to me if you still have trouble applying the build scan plugin.


Thanks for your reply back!

The build scan is for an Android Project.

So the structure is as follows:
android -> app -> src
-> buildSrc -> scan-project -> build.gradle
-> versions.gradle

So I need to create build.gradle under scan-project. I need to scan versions.gradle and files under app directory. Parent directory is android.

Also that is great new iwth version 1.14 and build scan.

Thank you!

Hi @ConnectionistSystems

I don’t understand why you have a scan-project project in your buildSrc folder.
What are you trying to collect in your build scan? Typically, you should apply the build scan plugin in the build.gradle file at the root of your android project.

@ConnectionistSystems, can I close this ?