How to consume a version catalog in a G7.2 custom plugin?

Hello,

I have a Gradle 7.2 custom stand-alone plugin that is working properly. I want to configure it to use the new Gradle Version Catalog for dependency information. I know how to configure and use the version catalog, and am sharing it as a jar with several builds. Everything is working well…

However, I cannot seem to find the correct incantation to consume the version catalog jar by the plugin when it is configuring dependencies. I keep getting “Extension of type ‘VersionCatalogsExtension’ does not exist”.

Here are two snippets showing what I have done to access the version catalog in the apply() method of the stand-alone plugin.

override fun apply(project: Project) {
        val libs = project
           .extensions
           .getByType(VersionCatalogsExtension::class.java)
           .named("libs")
        
        addBuildDependencies(libs)
            .
            .
            .
private fun Project.addBuildDependencies(libs: VersionCatalog) {
    dependencies.apply {
        // BOMs
        add(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, platform(libs.findDependency("arrow.bom").get()))
        add(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, platform(libs.findDependency("detekt.bom").get()))

I’d appreciate any snippets or redirects.

Thanks, Mike