Gradle 7.1.1 broke sourceSet redirect?

This JUnit test started failing after an upgrade to 7.1.1

public void testGradlesAbilitytoLoadCorrectly() {
    URL resource = DevTemplateService.class.getResource("/mytestfile.html");


The code in the gradle file that used to put mytestfile.html on the testClassPath was the following

sourceSets {
    test {
        resources {
            //This ADDS src/main/java/**/*.html and we still read in src/test/resources/**
            srcDirs = ["src/test/java", "src/test/resources"]
            excludes = ["**/*.java"]

What is the NEW way of doing this in gradle 7.1.1?

Hmmm, better yet, how to do this in the plugin itself so projects do not need this groovy code at all? I keep going through Implementing Gradle plugins

but there is nothing on modifying classpath here for tests and I need to run from IDE as well so not sure IDE will obey the classpath(but that’s a different issue).

You should move the html files to the resources directory, or create a “src/test/htmls” and move the html files, and add only the src/test/htmls to the srcDirs.

sourceSets.test.resources.srcDirs += 'src/test/htmls'