Actually, you can even do without the Action
variant.
And with the latest master
it just works with this from Groovy DSL:
import static dev.aga.gradle.versioncatalogs.Generator.INSTANCE as Generator
plugins {
id("dev.aga.gradle.version-catalog-generator")
}
dependencyResolutionManagement {
versionCatalogs {
Generator.generate(it, 'testLibs') {
it.from {
it.toml {
it.libraryAlias = 'xyz'
}
}
}
}
}
But there are other quirks in your plugin, for example:
- if you specify an entry without version nor version.ref, you get a not too helpful exception, maybe the message should be pimped a bit, for example including the alias name and file name or similar
- if the specified POM does not have
dependencyManagement
, you get aNullPointerException
instead of a message like “xyz is not a BOM you dork” - you use
File
constructor with a relative path at https://github.com/austinarbor/version-catalog-generator/blob/main/plugin/src/main/kotlin/dev/aga/gradle/versioncatalogs/GeneratorConfig.kt#L99; this is practically always a very bad idea in any Java project. Because that means the relative path is resolved relative to the current working directory, which is often not what you would expect. And for example for Gradle builds it sometimes is the project directory, but often it is the daemon log directory, or the ide installation directory, or whatever. Any Gradle build that depends on the current working directory like that is broken and flaky and can fail any time randomly.