JvmTestSuite - How to refer to the project's resource directory

Hi, in the build.gradle of my Spring Boot project, I’d like to use the project’s resource directory for my integration tests. Here’s an excerpt of my build.gradle:

plugins {
    id 'java'
    id 'jvm-test-suite'
    id 'org.springframework.boot' version '3.2.1'
    id 'io.spring.dependency-management' version '1.1.4'
}

group = 'com.sprite'
version = '0.0.1-SNAPSHOT'

java {
  sourceCompatibility = '17'
}

repositories {
  mavenCentral()
}

dependencies {
  ...
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
  testImplementation 'org.junit.jupiter:junit-jupiter-api'
  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

testing {
  suites {
    integrationTest(JvmTestSuite) {

      // Commented out because it doesn't work  
      //resources.srcDir file('src/main/resources')
      
      dependencies {
        implementation project(':')
      }
    }
  }
}

configurations {
  integrationTestImplementation.extendsFrom testImplementation
  integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
tasks.named('check') {
  dependsOn(testing.suites.integrationTest)
}

Thanks in advance

Why should you want to do that?
You already depend on the main source set, so you already have its resources on the classpath.
You really should not define production resource folder as test resources.


Besides that, you should stop using the Spring dependency management plugin. It is an obsolete relict from times when Gradle did not have built-in BOM support, by now does more harm than good, and even its maintainer recommends not to use it anymore, but instead the built-in BOM support with platform(...).