https://kotlinlang.org logo
#gradle
Title
# gradle
a

Alexander Stark

06/19/2023, 5:20 PM
Has anybody experience with version catalogues? I wonder if its' possible to declare a version and add
!!
to the version ref if needed.
Copy code
...
[versions]
monorepo="20230101"
...
[libraries]
...
lib1 = { module = "com.lib:lib1", version.ref = "monorepo" }
lib2 = { module = "com.lib:lib2", version.ref = "monorepo"+"!!" }
I didn't find anything in the toml documentation https://toml.io/en/
j

Javier

06/19/2023, 5:22 PM
what does
!!
mean ?
a

Alexander Stark

06/19/2023, 5:22 PM
to enforce this version of lib2 even if another library uses internal another version. With that you can override transitive dependencies
j

Javier

06/19/2023, 5:22 PM
check strict
a

Alexander Stark

06/19/2023, 5:23 PM
E.g. lib1 uses version 1.0.0 of lib2 But you want to overwrite this in your app with version 1.0.1 of lib2
a

Alexander Stark

06/19/2023, 5:25 PM
But with strict I'm not able to use my declared version ref, right?
j

Javier

06/19/2023, 5:34 PM
Copy code
[versions]
my-lib = { strictly = "[1.0, 2.0[", prefer = "1.2" }
v

Vampire

06/19/2023, 5:54 PM
Besides the verbose syntax Javier showed, you can of course also use the short-hand
!!
syntax. But not like you did it. Declare a second version entry where either the
!!
or the verbose variant is used and then use that in the
version.ref
Aaaand have a look at the channel topic. 😉
j

Javier

06/19/2023, 5:55 PM
that is not documented I think
v

Vampire

06/19/2023, 5:56 PM
What is not documented?
The
!!
or that you can use it in the version catalog?
j

Javier

06/19/2023, 5:56 PM
the
!!
in version catalog
v

Vampire

06/19/2023, 5:56 PM
There is no need to
You can use any version specification in the version catalog that you can also use otherwise.
It is not necessary to mention that explicitly
Noone said that only plain dumb versions are supported in version catalogs
a

Alexander Stark

06/19/2023, 6:44 PM
Thanks Björn
Declare a second version entry where either the
!!
or the verbose variant is used and then use that in the
version.ref
That's what I already did. But I thought I could avoid the second version entry
Aaaand have a look at the channel topic. 😉
Thanks, you're right