Hello there everyone. I'm wondering whether I can ...
# community-support
t
Hello there everyone. I'm wondering whether I can publish only certain plugins to Gradle Plugin Portal from my gradlePlugins block. So I have two plugins that I want to publish and 5 internal plugins that I don't want to publish to Gradle Portal but I haven't found the way to exclude certain plugins from publishing. Gradle Version is 8.8. Gradle plugin-publish - 1.2.1. Here is the snippet
Copy code
gradlePlugin {

    website.set("<https://github.com/Timbermir/clean-wizard>")
    vcsUrl.set("<https://github.com/Timbermir/clean-wizard.git>")

    plugins {
        libs.plugins.cleanwizard.apply {

            val pluginConfigVersions = pluginConfig.versions.cleanwizard

            register(core.pluginId) {
                id = core.pluginId
                implementationClass = pluginConfigVersions.root.implementation.get()
                displayName = "Clean Wizard Root Project Plugin"
                description = "This plugin is required for advanced configuration"
                tags.set(
                    listOf(
                        "kotlin",
                        "ksp",
                        "kotlin-symbol-processing",
                        "android",
                        "clean-architecture",
                        "domain-model",
                        "ui-model",
                        "dto-entity-mapper",
                    )
                )
            }

            register(multimodule.pluginId) {
                id = multimodule.pluginId
                implementationClass = pluginConfigVersions.multimodule.implementation.get()
                displayName = "Clean Wizard Multi Module Plugin"
                description = "This plugins is required for across module generation"
                tags.set(
                    listOf(
                        "kotlin",
                        "ksp",
                        "kotlin-symbol-processing",
                        "android",
                        "clean-architecture",
                        "domain-model",
                        "ui-model",
                        "dto-entity-mapper",
                    )
                )
            }

            register(internal.kotlin.pluginId) {
                id = internal.kotlin.pluginId
                implementationClass = pluginConfigVersions.kotlin.implementation.get()
            }

            register(internal.codegen.pluginId) {
                id = internal.codegen.pluginId
                implementationClass = pluginConfigVersions.codegen.implementation.get()
            }

            register(internal.processor.pluginId) {
                id = internal.processor.pluginId
                implementationClass = pluginConfigVersions.processor.implementation.get()
            }

            register(internal.visitor.pluginId) {
                id = internal.visitor.pluginId
                implementationClass = pluginConfigVersions.visitor.implementation.get()
            }

            register(internal.publish.pluginId) {
                id = internal.publish.pluginId
                implementationClass = pluginConfigVersions.publish.implementation.get()
            }
        }
    }
}
So I want to publish plugins that doesn't have
internal
in their id If it is not possible to do so, how can I publish only certain plugins using default
maven-publish
?
v
Using
maven-publish
would be no problem as you get publish tasks for each plugin separately. But I guess the
publishPlugins
task is the one sending the metadata to the portal even if
maven-publish
is used for the artifact uploading. Besides that, if you have all plugins in one project, all their code is in one code artifact. You just additionally have one marker artifact per plugin id so that the plugin id can be resolved to coordinates by naming convention. So even if you are able to only publish a part of the plugins, it would only leave out the marker artifacts and thus more hide the internal plugins a tiny bit, but not making them inaccessible. I think you should split your plugins into at least two projects (can be in the same build), then you can easily control what gets published where.
t
I think the goal is only that the internal plugins don't have plugin marker artifacts being published and "publicized" on the portal (by "internal" I assume they're applied by the "public" plugins as internal "implementation details")
I don't remember what the java-plugin-plugin does exactly with the plugins declared in the gradlePlugins DSL. If it's only generating the META-INF/gradle-plugins files then you could create them yourself in replacement to the DSL declaration (the plugin also checks that the implementationClass actually exists though)
v
If that would be the case, I would just not have an entry for them at all and apply them by class, not ID.
t
thank youj
👌 1