Is there a way to override the version used by a p...
# community-support
j
Is there a way to override the version used by a plugin which is applied by another plugin and it is added to that plugin to the
implementation
configuration?
It is not appearing in the resolution strategy so the version cannot be overridden there
v
It is not appearing in the resolution strategy
It should be if you are in the right one. But as with normal dependencies, you shouldn't use it, but use a constraint instead. If you add an according constraint, for example to
buildscript { dependencies { } }
it should work iirc.
j
Is it not possible to override it somehow in the settings script? I like to avoid doing anything in the root project
v
Well, just add a buildscript dependency on it in the settings script. class loader from settings script is in the ancestors of class loader from build scripts, so if the lib is there, it will be used by classloader delegation
j
this should work?
Copy code
buildscript {
    dependencies {
        constraints {
            classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20")
        }
    }
}
v
No, there you need a dependency, not a constraint. A constraint just influences version selection if there is an actual dependency. And the constraint there would not influence the resolution for the build script classpath.
j
It is working if I put it on the settings script file, but it does not work if I put it in the root project
v
With the constraint in the settings script? o_O
j
Yep:
Copy code
Kotlin version: 2.0.20
If I comment the
classpath
line, then
Copy code
Kotlin version: 2.0.10
v
Hm, interesting. I thought this shouldn't do anything unless you add the Kotlin plugin to the settings script classpath