This message was deleted.
# plugin-development
s
This message was deleted.
e
feels like an odd thing to do, but
configuration2.resolutionStrategy.force("dep1:1.4.0")
?
t
hm, need to try it 🤔
g
or set constraint in
configuration2
t
Yep, declare the version as "strictly" https://docs.gradle.org/current/userguide/rich_versions.html#header (note there's also a shortcut notation:
dep1:1.4.0!!
)
g
I guess both ways (via constraint and resolution strategy) are good but constraint will be surely exposed to consumers (if you publish something from configuration2) and forced resolution shouldn't be exposed iirc
c
Not about the technical solution, but depending on the use case, maybe it's clearer if you have a baseConfiguration, and dep20Configuration and dep14Configuration extend from it
t
feels like an odd thing to do
It is
compileOnly
configuration, so it is ok to have different versions of same dependency 🙂
resolutionStrategy.force(...)
doesn't work 🤷‍♂️ Using rich versions causes the resolution excepion
c
this worked for me:
Copy code
val whatever by configurations.creating
whatever.extendsFrom(configurations.implementation.get())
whatever.resolutionStrategy.force("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.3.3")
dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.3.4")
}
whatever
+--- org.jetbrains.kotlinkotlin stdlib jdk81.6.10
| +--- org.jetbrains.kotlinkotlin stdlib1.6.10
| | +--- org.jetbrainsannotations13.0
| | \--- org.jetbrains.kotlinkotlin stdlib common1.6.10
| \--- org.jetbrains.kotlinkotlin stdlib jdk71.6.10
| \--- org.jetbrains.kotlinkotlin stdlib1.6.10 (*)
\--- org.jetbrains.kotlinxkotlinx cli jvm0.3.4 -> 0.3.3
+--- org.jetbrains.kotlinkotlin stdlib jdk81.4.30 -> 1.6.10 (*)
\--- org.jetbrains.kotlinkotlin stdlib common1.4.30 -> 1.6.10
(*) - dependencies omitted (listed previously)
🤔 1
t
anyway I will probably go with your proposed way and will add separate configuration for this dependency that will be additionally added to compile classpath
1
c
to me it's clearer, I expect it to be used in 2 variants or just for tests, so it will show the intention better and having a named configuration it's a plus