Getting hold of buildscript.dependencies

I know this is a bit of long shot, but is it possible to get hold of buildscript.dependencies.classpath configuration within a project?

The reason for asking is that I would want to have a task that can report within the project what the classpath dependencies are for the Gradle script

Yes, you can. Please see the following example:

buildscript {
    repositories {
        mavenCentral()
    }
    
    dependencies {
        classpath 'commons-lang:commons-lang:2.5'
    }
}

task printDeps {
    doLast {
        buildscript.configurations.classpath.each {
            println it
        }
    }
}
1 Like

Awesome! I’ll give it ago.