Proper and idiomatic way to include runtime classpath in compile classpath with transitive dependencies

I have a following Gradle project structure:

project-root/
├── adapters/
│   ├── adapter1/
│   │   ├── main
│   │   └── test
│   ├── adapter2/
│   │   ├── main
│   │   └── test
│   └── adapter3/
│       ├── main
│       └── test
└── app-spring-boot/
    ├── main
    ├── test
    └── integrationTest

In the app-spring-boot module, the adapters are included only as runtime dependency:

// project-root/app-spring-boot/build.gradle.kts
dependencies {
    runtimeOnly(project(":adapters:adapter1")
    runtimeOnly(project(":adapters:adapter2")
    runtimeOnly(project(":adapters:adapter3")
}

In the :adapters:adapterN modules, the dependencies are declared using implementation:

// project-root/adapters/adapter1/build.gradle.kts
dependencies {
      implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
}

In the app-spring-boot module for integrationTest source set, I would like to be able to access all dependencies at compile time not only directly from app-spring-boot, but from all of the included :adapters projects as well.

I’ve used following configuration:

// project-root/app-spring-boot/build.gradle.kts
plugins {
    `jvm-test-suite`
}

testing {
    suites {
        val test by getting(JvmTestSuite::class)

        val integrationTest by registering(JvmTestSuite::class) {
            useJUnitJupiter()
            dependencies {
                implementation(project())
            }
            sources {
                compileClasspath += sourceSets.main.get().runtimeClasspath
            }
        }
    }
}

compileClasspath += sourceSets.main.get().runtimeClasspath does the trick and all dependencies from included runtimeOnly projects are accessible at compile time, but I’m wondering what it is the correct and idiomatic Gradle way of doing it, especially since I saw this SO comment.

Removing compileClasspath += sourceSets.main.get().runtimeClasspath and adding configurations["integrationTestImplementation"].extendsFrom(configurations["runtimeClasspath"]) doesn’t include transitive dependencies.