How to set buildSrc directory for Gradle executed by GradleBuild task


(Crazyjavahacking) #1

I am trying to figure out how to set the buildSrc directory for the Gradle build executed by GradleBuild task:

task clean(type: GradleBuild) {
    buildFile = file('buildLogic/build.gradle')
    tasks     = ['clean']
}

and the directory structure is:

buildSrc
    - src
        - main
            - groovy
buildLogic
    - build.gradle
build.gradle

Is it even possible?


(Crazyjavahacking) #2

I found a workaround:

buildscript {
    dependencies {
        classpath files(new File(projectDir.parentFile, 'buildSrc/build/classes/main').toURL())
    }
}