I have a pattern in my codebase where I have libraries created in a map, and it appears to operate very similar to how the versionCatalogs functionality works. I’m trying to migrate to the gradle way of doing things rather than having my one off way of doing things. I’m not quite sure how to exclude transitive dependencies.
In my home rolled way of doing it, I have something like this:
def libraries = [
groovy_all: dependencies.create("org.codehaus.groovy:groovy-all:3+") {
exclude group: "org.codehaus.groovy", module: "groovy-swing"
}
]
I’m trying something like this in the new way of doing things, but it isn’t working as I expect:
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
library("groovy-all", "org.godehaus.groovy:groovy-all:3.0.9") {
exclude(group = "org.codehaus.groovy", module = "groovy-swing")
}
}
}
}