Gradle 7.0 migration: how to remove a JAR from compileClasspath

Viewed 57

We were previously using this snippet in our build.gradle.kts file to remove a dependency that was added to the compileClasspath by another plugin:

project.afterEvaluate {
    sourceSets {
        main {
            compileClasspath -= files(the_jar_to_remove)
        }
    }
}

We are now trying to migrate from Gradle 6.8 to 7.2 and this seems to have no effect anymore. When the javaCompile task runs, I can see that the JAR is still there in the classpath (using --debug).

Is there any way to achieve the same thing with Gradle 7.0?

FYI, this "trick" was found here and here.

0 Answers
Related