I am trying the new TestSuit from Gradle. I have this in my project:
testing {
suites {
val integrationTest by registering(JvmTestSuite::class) {
useJUnitJupiter()
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
jvmArgs("--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED")
}
}
But when I run ./gradlew integrationTest, I get:
/buildSrc/src/main/kotlin/quarkus-testing.quarkus-conventions.gradle.kts: (35, 13): Unresolved reference: jvmArgs
How to configure jvmArgs now?
I recently solved this by working down the hierarchy, from the JvmTestSuite
object to the Test
object which is the object that contains the jvmArgs
reference.
testing {
suites {
val integrationTest by registering(JvmTestSuite::class) {
useJUnitJupiter()
// here: really calling JvmTestSuite#getTargets() then,
// DomainObjectCollection#all(Action)
targets.all {
// here: really calling JvmTestSuiteTarget#getTestTask() then,
// TaskProvider#configure(Action)
testTask.configure {
// now we're operating on a Test instance
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
jvmArgs("--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED")
}
}
}
}
}