After upgrading to Gradle 7 and replacing testRuntime with testRuntimeOnly in the following lines in my build.gradle file:
I am getting the following error:
“ Resolving dependency configuration ‘testRuntimeOnly’ is not allowed as it is defined as ‘canBeResolved=false’. Instead, a resolvable (‘canBeResolved=true’) dependency configuration that extends ‘testRuntimeOnly’ should be resolved. “
Any idea how to fix this?
Could not determine the dependencies of task ‘:integrationTest’.
Resolving dependency configuration ‘testRuntimeOnly’ is not allowed as it is defined as ‘canBeResolved=false’. Instead, a resolvable (‘canBeResolved=true’) dependency configuration that extends ‘testRuntimeOnly’ should be resolved.
Exception
org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ‘:integrationTest’.
at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:71)
•••
Caused by: java.lang.IllegalStateException: Resolving dependency configuration ‘testRuntimeOnly’ is not allowed as it is defined as ‘canBeResolved=false’.
Instead, a resolvable (‘canBeResolved=true’) dependency configuration that extends ‘testRuntimeOnly’ should be resolved.
How are you using the testRuntimeOnly configuration? I suspect that you’re trying to use it to configure the classpath of your integrationTest task. If so, use the testRuntimeClasspath configuration instead. Or use a sourceSet’s runtimeClasspath, similar to what’s shown in Testing in Java & JVM projects
Hi, Thank you.
Correct, but the following step is necessary because of duplicate copiesThank you. It worked. I have another question. I have server.xml for Liberty configuration. For my integration test. I expect this code within Gradle (7.1.1) to copy server.xml for Server INstanz. But it doesn’t happen.
// Tell the liberty plugin about the server to use in the test
features {
acceptLicense = true
}
def configFile = file('src/integrationTest/resources/test-server.xml')
bootstrapProperties = ['appLocation':war.archiveName]
def apps = [war]
// The name of the server instance to create. The default value is defaultServer.
name = 'integrationTestServer'
// Inline List of jvm options that is written to the jvm.
// options file in the server directory. These properties take precedence over a specified jvm.options file.
jvmOptions = ["-javaagent:${projectDir}/src/integrationTest/resources/jacocoagent.jar=destfile=${project.buildDir}/jacoco/jacoco-it.exec,append=false,includes=${gradle.ext.itIncludePath}"]
}
}
with this def configFile = file(‘src/integrationTest/resources/test-server.xml’)
I expect test-server.xml to be copied as server.xml for the server instance “integrationServer”. But unfortunately no. Why?
That was a problem or a change in Liberty Server from IBM. I read the IBM site and got through
// Configuration files and folder structure will be copied to the server instance.
configDirectory = file (‘src / integrationTest / resources’)
I have a little problem, when executing Gradle 7.1.1 in my dependencies I have a dependency from a local service as xxx.jar, why if ch was executing build locally, does Gradle not find the jar file?