I have the same issue as the referenced issues below. Where I want two different versions of the same library. But the solution is in Groovy DSL, if I try them with Kotlin DSL the solution gives a compile error.
Well, what do you expect if you copy Groovy code into Kotlin code?
That is like you copy C# code into Java code.
The probability that it is working is nearly 0.
Also next time, if you post about some error you get,
it would be helpful if you quote the error you are getting,
optimally as build --scan URL if you can.
configurations {
SparkV2
SparkV3
}
is not valid Kotlin code as you have observed.
In Groovy this is syntactic sugar for creating two configurations.
In Kotlin you would for example do
val SparkV2 by configurations.registering
val SparkV3 by configurations.registering
Besides that both, the Groovy version and the Kotlin version are creating configurations that are setup in a legacy way that you should not use.
Configurations should be dedicated to either be consumed by other projects, resolved in the current build, or used to declare dependencies on it, but not multiple of this.