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

Publish plugin marker artifact to Sonatype #104

Closed
technoir42 opened this issue May 11, 2020 · 9 comments
Closed

Publish plugin marker artifact to Sonatype #104

technoir42 opened this issue May 11, 2020 · 9 comments

Comments

@technoir42
Copy link

technoir42 commented May 11, 2020

Version 0.9.2-SNAPSHOT cannot be applied using plugins DSL because marker artifact is missing from Sonatype.

// settings.gradle:
pluginManagement {
    repositories {
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots/"
            mavenContent {
                snapshotsOnly()
            }
        }
        gradlePluginPortal()
    }
    plugins {
        id "com.osacky.fladle" version "0.9.2-SNAPSHOT"
    }
}

// build.gradle:
plugins {
    id "com.osacky.fladle" 
}
Plugin [id: 'com.osacky.fladle', version: '0.9.2-SNAPSHOT'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.osacky.fladle:com.osacky.fladle.gradle.plugin:0.9.2-SNAPSHOT')
  Searched in the following repositories:
    maven(https://oss.sonatype.org/content/repositories/snapshots/)
    Gradle Central Plugin Repository
@runningcode
Copy link
Owner

Thanks for filing the issue with the error and your buildscript.

It looks like you are specifying the wrong artifact. it should be asking for com.osacky.flank.gradle:fladle:0.9.2-SNAPSHOT
I'm not sure what the correct syntax using pluginMangement would be. But using the old syntax it would look like this:

buildscript {
  repositories {
    maven {
      url "https://oss.sonatype.org/content/repositories/snapshots/"
    }
  }
  dependencies {
    classpath "com.osacky.flank.gradle:fladle:0.9.2"
  }
}

apply plugin: "com.osacky.fladle"

@technoir42
Copy link
Author

I copy-pasted the example for plugins DSL from https://plugins.gradle.org/plugin/com.osacky.fladle and just changed the version to 0.9.2-SNAPSHOT.

@technoir42
Copy link
Author

technoir42 commented May 11, 2020

com.osacky.fladle:com.osacky.fladle.gradle.plugin:0.9.2-SNAPSHOT is coordinates of the marker artifact which typically gets published to Gradle plugin portal, but it can also be published to any other repository like Sonatype so plugins DSL would also work with that repository.

@runningcode
Copy link
Owner

runningcode commented May 11, 2020

I can confirm that the buildscript syntax I specified in the comment above works. The plugin is publishing the marker correctly as com.osacky.flank.gradle:fladle:0.9.2-SNAPSHOT.
I'm going to try to find the correct syntax to use for the pluginManagement.

@runningcode
Copy link
Owner

Oh, I see what you mean with the market artifact: https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers

@runningcode
Copy link
Owner

The following syntax will work:
settings.gradle

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.namespace == "com.osacky") {
                useModule("com.osacky.flank.gradle:fladle:${requested.version}")
            }
        }
    }
    repositories {
        maven {
            url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
        }
        gradlePluginPortal()
    }
}

build.gradle.kts

plugins {
  id("com.osacky.fladle") version "0.9.2-SNAPSHOT"
}

@runningcode
Copy link
Owner

Waiting on permission to publish the marker artifact: https://issues.sonatype.org/browse/OSSRH-57528
Thanks for filing this!

@runningcode
Copy link
Owner

Snapshot marker has been published! I'll update the release instructions to ensure that this is always published.

runningcode added a commit that referenced this issue May 11, 2020
Add documentation for publishing plugin marker.
Add documentation on how to use snapshots.
Add documentation for build failures when upgrading to 0.9.X

Fixes #102, #103, #104
runningcode added a commit that referenced this issue May 11, 2020
Add documentation for publishing plugin marker.
Add documentation on how to use snapshots.
Add documentation for build failures when upgrading to 0.9.X

Fixes #102, #103, #104
@runningcode
Copy link
Owner

Added this to the docs as well: https://runningcode.github.io/fladle/snapshots/

Thanks again for filing this. Closing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants