Issue
when trying to upgrade my gradle version from 5.x to 7.x, getting below error
* What went wrong:
Configuration with name 'integrationTestCompile' not found.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Below is my code
sourceSets {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.test.get().output
}
}
val integrationTestCompile: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}
val integrationTestRuntimeOnly: Configuration by configurations.getting {
extendsFrom(configurations.testRuntimeOnly.get())
}
tasks {
val integrationTest by creating(Test::class) {
description = "Running integration tests."
group = "verification"
testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
shouldRunAfter("test")
}
}
Using gradle with kotlin.
How to fix this?
Solution
In below way you can create integrationTest
task in gradle latest version
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
}
sourceSets {
integrationTest {
compileClasspath += sourceSets.main.output
compileClasspath += configurations['testRuntimeClasspath']
runtimeClasspath += compileClasspath
}
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
mustRunAfter test
}
Answered By - mario
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.