Is there an alternate place I can publish a gradle...
# gradle
r
Is there an alternate place I can publish a gradle plugin in addition to the plugin portal? I have a plugin I wrote that I need to use in a project, but I am still pending approval on the plugin portal. I've tried publishing to github packages, but it seems it doesn't support gradle plugins, only gradle packages unless I'm mistaken.
m
MavenCentral works well
a
you can publish Gradle plugins to any Maven repository. You can even publish one to a GitHub branch if you hack around (example). Publishing to GitHub packages should work fine, what problems do you get? Just keep in mind that a Gradle plugin has two Maven artifacts with separate GAV coordinates. One contains the compiled JAR with your plugin, and the other contains the plugin marker that points from your plugin ID to the actual plugin JAR.
r
@Adam S I see a 422 error when trying to put my JAR to github packages. https://github.com/rf19l/KtXMLConverter/actions/runs/5637362260/job/15270385441#step:5:530
I've tried a lot of variations on the publishing block that work fine for the plugin portal, but always fail when trying to publish to github. Here's the publishing block of my build.gradle
Copy code
gradlePlugin {
    website.set("<https://github.com/rf19l/ktxmlconverter>")
    vcsUrl.set("<https://github.com/rf19l/ktxmlconverter.git>")
    plugins {
        create("ktxmlconverter") {
            displayName = "ktxmlconverter"
            id = "$group"
            description = "A Gradle plugin to convert XML files to Kotlin data objects"
            implementationClass = "com.rf.foster.ktxml.ktXMLConverter"
            tags.set(listOf("testing", "integrationTesting", "compatibility"))

        }
    }
}

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("<https://maven.pkg.github.com/rf19l/ktxmlconverter>")
            credentials {
                username = System.getenv("GITHUB_ACTOR") ?: ""
                password = System.getenv("GITHUB_TOKEN") ?: ""
            }
        }
    }
}
a
I think GitHub Packages restricts the group name, so it has to be
io.rf19l
or something. But the group of your project is com.rf.foster.ktxml
👀 1
it looks more of a GitHub Packages problem than a Kotlin or Gradle problem
GitHub Packages kind of sucks because they still require authentication for consumers, which is a hassle
r
Ah so whichever app I want to use this package will have to have an access token from my github account or their own github account?
a
yes
r
Ahh well yea that is annoying, it should work for me in a pinch. I wrote this to help make the jetpack compose transition smoother at work, so I need it going into the week.
a
so if I wanted to use your plugin via GitHub Packages I’d have to create an access token, and then figure out how to register the repository in Gradle (which again, is a hassle because Gradle doesn’t have an easy way to add a repo with authentication, so I’d have to figure out which answer to copy-paste from StackOverflow)
well, while you’re waiting for Gradle Plugin Portal approval the easiest way would be to publish the plugin to Maven Local, and add Maven Local as a plugin repository
r
True that sounds like a lot less of a hassle considering github was just a temporary solution anyway.
👍 1
a
or you could check out both projects and add the plugin project as an included build https://docs.gradle.org/current/userguide/composite_builds.html#included_plugin_builds
r
Interesting I'll take a look thanks!
👍 1