protoc-gen-doc icon indicating copy to clipboard operation
protoc-gen-doc copied to clipboard

deploy to maven central

Open jorgheymans opened this issue 6 years ago • 7 comments

protoc works nicely out of the box with maven because they package the binary to maven central. Is anything foreseen to get protoc-gen-doc deployed on maven central as well ?

jorgheymans avatar May 14 '18 10:05 jorgheymans

To be completely honest I hadn't considered it. I wasn't aware maven central hosted binaries (I've only ever used them for JVM packages).

Would you be able to outline how the process would work?

pseudomuto avatar May 17 '18 00:05 pseudomuto

Well at least protoc is there as well https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.5.1-1/, I'm sure there are others.

I have never done this myself, from what I have seen around likely bintray is involved eg https://veithen.github.io/2013/05/26/github-bintray-maven-release-plugin.html

Op do 17 mei 2018 02:59 schreef David Muto [email protected]:

To be completely honest I hadn't considered it. I wasn't aware maven central hosted binaries (I've only ever used them for JVM packages).

Would you be able to outline how the process would work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pseudomuto/protoc-gen-doc/issues/357#issuecomment-389711328, or mute the thread https://github.com/notifications/unsubscribe-auth/AAL1AFD7qEjSCJmXTrmDp6XU1LdpeKS8ks5tzMtegaJpZM4T9hxv .

jorgheymans avatar May 17 '18 06:05 jorgheymans

This would be extremely useful for us, it is quite simple to get this tool integrated with https://github.com/google/protobuf-gradle-plugin so the documentation can be generated during gradle tasks when the binaries have been published to maven-central.

Taking a look at the steps, it looks like after sign-up for using nexus etc, the binaries would just need to be published under the following names: Windows binary: protoc-gen-doc-1.3.0-windows-x86_64.exe Linux binary: protoc-gen-doc-1.3.0-linux-x86_64.elf

I have opened a ticket to clarify the naming for the linux binary: google/protobuf-gradle-plugin#329

But after that it becomes quite nice and simple to get this integrated into a gradle pipeline:

apply plugin: 'com.google.protobuf'

ext {
    architecture = project.osdetector.classifier
    executableExtension = architecture == "windows-x86_64" ? "exe": "elf"
}

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.9.1'
    }

    plugins {
        doc {
            // Using DEV versions
            artifact = "com.github.pseudomuto:protoc-gen-doc:1.3.0:$architecture@$executableExtension"
        }
    }

    generateProtoTasks {
        all().each { task ->
            task.plugins {
                doc {
                    option 'html'
                    option 'index.html'
                }
            }
        }
    }
}

davidjlynn avatar Aug 14 '19 15:08 davidjlynn

This would be extremely useful for us too. We are trying to use it from maven builds and protoc-maven-plugin knows how to get protoc plugins bineries from maven central (that's how it gets protoc and protoc-gen-java) so this would mean developer need not to do anything by hand before using this plugin to build the docs, just as it works for generating java stubs.

lalloni avatar Feb 20 '20 15:02 lalloni

We also managed to get it working by publishing the binary artifacts using the same naming convention that: https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.10.0/ That is:

  • https://dl.bintray.com/repo/com/github/pseudomuto/protoc-gen-doc/1.3.1/protoc-gen-doc-1.3.1-linux-x86_64.exe
  • https://dl.bintray.com/repo/com/github/pseudomuto/protoc-gen-doc/1.3.1/protoc-gen-doc-1.3.1-osx-x86_64.exe
  • https://dl.bintray.com/repo/com/github/pseudomuto/protoc-gen-doc/1.3.1/protoc-gen-doc-1.3.1-windows-x86_64.exe

And then using this in the protobuf section of the gradle plugin plugins { doc { artifact = "com.github.pseudomuto:protoc-gen-doc:1.3.1" } }

The architecture is autodetected and the extension defaults to exe, but thats the extension the official google plugin naming convention uses

JesusMetapack avatar Apr 18 '20 21:04 JesusMetapack

@pseudomuto any chance you could publish it to Maven Central like @JesusMetapack did to bintray?

Our company is trying really hard to not add another repository for security reasons, and keep it constrained to only Maven central.

I recently did it for one of our company repos and followed https://dzone.com/articles/publish-your-artifacts-to-maven-central, took about an hour.

chomey avatar Mar 18 '21 21:03 chomey

@pseudomuto Thanks for accepting the PRs so far, I have been testing the publishing in my fork and there are some extra requirements needed before the versions can be published publicly. I will open a PR soon with the fixes. For interest, extra details were required in the POM file and the artefacts need signing. Just working on the signing now, shouldn't be too difficult from Gradle.

davidjlynn avatar Mar 12 '22 11:03 davidjlynn