This message was deleted.
# community-support
s
This message was deleted.
c
All the examples (and all I’ve done with version catalogs) use double quotes. Unknown whether toml works with single quotes.
e.g.
Copy code
[libraries]
groovy-core = { module = "org.codehaus.groovy:groovy", version.ref = "groovy" }
groovy-json = { module = "org.codehaus.groovy:groovy-json", version.ref = "groovy" }
groovy-nio = { module = "org.codehaus.groovy:groovy-nio", version.ref = "groovy" }
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version = { strictly = "[3.8, 4.0[", prefer="3.9" } }
a
Ohh crap. Sorry, I wasn't clear with my question. The question was in regard to quoting the key of the TOML entry itself (e.g.
groovy-core = ...
vs
"groovy.core" = ...
. Not quoting the keys of the elements.
FWIW, single quotes do work. 🙂
c
good to know re: single quotes! No, the key cannot be quoted. Gradle needs control over that to generate nested accessors.
a
ok. cool! I was hoping it would treat quoted keys the same as it would treat dotted keys for libraries in the settings.gradle method. e.g. this is valid:
Copy code
dependencyResolutionManagement {
    versionCatalogs {
        libs {
            library('<http://commons.io|commons.io>', 'commons-io', 'commons-io').version('2.11.0')
        }
    }
}
c
unfortunately not.
.
has a special meaning in Toml hence isn’t allowed in the alias;
-
give you the equivalently-generated accessors.
a
It could just be my ignorance of TOML. But, I was under the assumption that quoted keys allow for literal periods in keys, as opposed to dotted keys, which uses them to define hierarchy.
c
Cant speak for toml itself; Gradle uses the toml key as the alias, and doesn’t allow
.
in an alias. It doesn’t work for me taking an existing entry and trying a quoted version of it:
Copy code
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
"junit.jupiter.engine" = { module = "org.junit.jupiter:junit-jupiter-engine" }
to be clear - Gradle does allow
.
in programatically created aliases (settings.gradle.kts, for example) but not in TOML, whether quoted or not.
a
Awesome. Thanks for the info!
👍 1