Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use maven publish plugin for central publishing #276

Merged
merged 10 commits into from
Jun 2, 2021

Conversation

ZacSweers
Copy link
Contributor

Re-publish of #256

This simplifies setup using the gradle maven publish plugin for publishing to central. This removes jcenter publishing, but publishing just to central covers jcenter since it proxies it anyway.

https://github.com/vanniktech/gradle-maven-publish-plugin

This requires added local gradle properties (recommended to put them in your ~/.gradle/gradle.properties) for signing and auth, described here: https://github.com/vanniktech/gradle-maven-publish-plugin#where-to-upload-to

Most significantly, this automatically handles publishing the gradle plugin marker artifact as well so that it can be used directly in plugins {...}

This also makes snapshots development (./gradlew uploadArchives when the version ends in -SNAPSHOT) and local development ./gradlew install) easier

Resolves #267

This simplifies setup using the gradle maven publish plugin for publishing to central. This removes jcenter publishing, but publishing just to central covers jcenter since it proxies it anyway.

https://github.com/vanniktech/gradle-maven-publish-plugin

This requires added local gradle properties (recommended to put them in your ~/.gradle/gradle.properties) for signing and auth, described here: https://github.com/vanniktech/gradle-maven-publish-plugin#where-to-upload-to

Most significantly, this automatically handles publishing the gradle plugin marker artifact as well so that it can be used directly in `plugins {...}`
@fractalwrench
Copy link
Contributor

fractalwrench commented Aug 21, 2020

Hey Zac - just a note that publishing to Bintray is now a requirement again. The reason we were doing it is that anyone using a wildcard dependency with only jcenter() as a repository source wouldn't resolve the bugsnag-android-gradle-plugin dependency. For example, the following code would fail without uploading to Bintray:

repositories {
    jcenter()
}

dependencies {
    classpath "com.bugsnag:bugsnag-android-gradle-plugin:5.+"
}

I believe this is down to Bintray searching its own artefacts but not mavenCentral's when a wildcard is supplied. Therefore unfortunately unless there's a workaround that supports this behaviour we need to continue publishing artefacts to Bintray.

@ZacSweers
Copy link
Contributor Author

ZacSweers commented Aug 22, 2020

jcenter never ceases to amaze me with how terrible it is for the JVM ecosystem. I'll try update this to support publishing there too, likely via script like publish.sh that runs uploads multiple times to different repo urls

Their API and plugin are both in bad shape and I don't want to deal with it
@ZacSweers
Copy link
Contributor Author

CI failure seems like it might be a flake or caching issue?

@fractalwrench fractalwrench changed the base branch from master to next September 9, 2020 11:13
@fractalwrench
Copy link
Contributor

Hi Zac, I tried this out after resolving the conflicts against the next branch. Installing the plugin locally does seem to work and I can see javadoc is attached to the jars, but I'm running into trouble when running the uploadArchives or bintrayUpload task, namely:

./gradlew uploadArchives `
Configuration(s) specified but the install task does not exist in project :.
Publication Publication not found in project :.

This seems to result in only the bugsnag-android-gradle-plugin-5.X.X.jar being uploaded to Sonatype, and similar behaviour for Bintray. I'm assuming that there's some difference in the vanniktech plugin that it doesn't pick up the rest of these files by default. I think this would be the only obstacle to merging this PR.

@ZacSweers
Copy link
Contributor Author

Let me take a look and test this out locally

@ZacSweers
Copy link
Contributor Author

@fractalwrench can you test again? I think the install task issue was due to a previous configuration being leftover that I removed in f6e7a85.

I see all the requisite files when I install locally

image

I don't really understand these errors from the bintray plugin

Configuration(s) specified but the install task does not exist in project :.
Publication BintrayPublication not found in project :.

The bintray plugin is... not good. We use jfrog internally in combination with this plugin for publishing, could you try the latest change with ./gradlew uploadArchivesBintray? Specify the user and key as you did before

@fractalwrench
Copy link
Contributor

This seems to work nicely when installing locally, after setting the sourceCompatibility to JDK 8 explicitly. It also appears to upload the correct artefacts to Sonatype although I've not tried resolving the dependency from the staging repository as of yet. The bintray publish task seems to have advanced onto a new error message:

Execution failed for task ':publishPluginMavenPublicationToBintrayRepository'.
Failed to publish publication 'pluginMaven' to repository 'bintray'
Could not PUT 'https://api.bintray.com/maven/fractalwrench/artifact-sandbox/;publish=1/com/bugsnag/bugsnag-android-gradle-plugin/5.3.0/bugsnag-android-gradle-plugin-5.3.0.jar'. Received status code 404 from server: Not Found

I tried altering the URL to use bugsnag rather than $bintray_user which advanced things a little further, but I got caught up on a similar error message:

Execution failed for task ':publishPluginMavenPublicationToBintrayRepository'.
Failed to publish publication 'pluginMaven' to repository 'bintray'
Could not PUT 'https://api.bintray.com/maven/bugsnag/artifact-sandbox/;publish=1/com/bugsnag/bugsnag-android-gradle-plugin/5.3.0/bugsnag-android-gradle-plugin-5.3.0.jar'. Received status code 404 from server: Not Found

bintray_user and bintray_api_key are both present in ~/.gradle/gradle.properties, so I'm not too sure what's going on here.

Also I noticed that publish=1 - I've altered this to publish=0 as my understanding is that the first would publish the package automatically.

@lemnik lemnik merged commit 27483ce into bugsnag:next Jun 2, 2021
@johnkiely1
Copy link
Member

Hey @ZacSweers,

Just to let you know this has now been released in V5.7.7.
Thanks again for the PR.

@johnkiely1 johnkiely1 added the released This feature/bug fix has been released label Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This feature/bug fix has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing sources in 5.0.0-alpha1
4 participants