Creating new SourceSet warning after gradle 9 upgrade (kotlin dsl)

We upgraded to gradle 9 yesterday. We are using the Kotlin DSL. Post-upgrade we are getting a warning when setting up a integration test sourceset. Everything is still working so this is more than likely something I am doing incorrectly.

val integrationTest: SourceSet = sourceSets.create("integrationTest") {
    java {
        compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output
        runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output
        srcDir("src/integration-test/java")
    }
    resources.srcDirs("src/integration-test/resources")
}

configurations[integrationTest.implementationConfigurationName].extendsFrom(configurations.testImplementation.get())
configurations[integrationTest.runtimeOnlyConfigurationName].extendsFrom(configurations.testRuntimeOnly.get())

In the sourceSets.create(“integrationTest”) sourceset I am getting the following warning:

Cannot infer type for type parameter 'S'. Specify it explicitly. 

I can’t figure out exactly what needs to be typed here. No matter what I remove or add the warning is present.

Thank you in advance for any assistance.

Actually, it is questionable whether integration tests should access main and test sources, integration tests should usually more be black-box testing, but that is a matter of PoV.

Why you get that warning is hard to say as you shared too less context, for example where you get that warning.
If I copy & paste your snippet into a Gradle 9 build script, there is no warning.
So you probably should share a proper MCVE to show your problem.

Besides that, even with it being still incubating, I’d recommend considering to use the JVM test suites plugin to set up integration tests or other test types. :slight_smile:

Also seeing this issue, using the exact example in the documentation under configuring java integration tests:

Note: This warning is in intellij - so it could be a false positive there as it appears to work as normal.

Yes looks to be an intellij and not a gradle issue:

Changing my code to:

sourceSets {
    create("integrationTest", Action<SourceSet> {
            compileClasspath += sourceSets.main.get().output
            runtimeClasspath += sourceSets.main.get().output
    })
}

Fixes the intellij error. Will keep an eye on the JVM test suites plugin

Which error do you see and where and with which IDE version?

Hi @Vampire I’m on IntelliJ IDEA 2025.2 (Ultimate Edition) and I see:

Just upgraded to latest 2025.2.1 patch and it still gives the same warning.

As gradle appears to be working just fine, so chalking it down to intellij providing a false positive.

Ah, I’m still on 2025.1, that’s maybe why.
What is the concrete error it displays?
You should probably report it to KTIJ project on JetBrains YouTrack so that the Kotlin plugin can get fixed.

I believe its the same as this issue: KTIJ-34210 - I’ve added some extra notes to the ticket.