gradle-nexus / publish-plugin

Gradle plugin for publishing to Nexus repositories
Apache License 2.0
384 stars 30 forks source link

Publish plugin marker artifacts to Maven Central #307

Open Goooler opened 4 months ago

Goooler commented 4 months ago

We support marker artifacts on Maven Central, which enables snapshots publishing, allowing users to try out snapshots.

szpak commented 4 months ago

I was sure, there is already a task for that, but it is not. Maybe we were just talking about that with Mark at the project inception.

Goooler commented 4 months ago

From my observation, Spotless and this plugin itself don't have plugin marker artifacts, but Detekt does. Note that they both use GNPP for Maven Central publishing. Are you saying that GNPP doesn't support the publication of plugin marker artifacts?

Goooler commented 4 months ago

Publishing my project to MavenLocal and view the plugin marker artifact:

13:08:30: Executing 'publishToMavenLocal --no-configuration-cache'...

> Task :compileJava FROM-CACHE
> Task :compileGroovy NO-SOURCE
> Task :pluginDescriptors
> Task :processResources
> Task :classes
> Task :jar
> Task :javadoc FROM-CACHE
> Task :javadocJar
> Task :sourcesJar
> Task :generateMetadataFileForMavenJavaPublication
> Task :generatePomFileForMavenJavaPublication
> Task :signMavenJavaPublication
> Task :generatePomFileForOsgiPluginPluginMarkerMavenPublication
> Task :signOsgiPluginPluginMarkerMavenPublication
> Task :generateMetadataFileForPluginMavenPublication
> Task :generatePomFileForPluginMavenPublication
> Task :signPluginMavenPublication
> Task :publishMavenJavaPublicationToMavenLocal
> Task :publishOsgiPluginPluginMarkerMavenPublicationToMavenLocal
> Task :publishPluginMavenPublicationToMavenLocal
> Task :publishToMavenLocal

BUILD SUCCESSFUL in 33s
18 actionable tasks: 16 executed, 2 from cache

cat ~/.m2/repository/io/github/goooler/osgi/io.github.goooler.osgi.gradle.plugin/0.8.3-SNAPSHOT/io.github.goooler.osgi.gradle.plugin-0.8.3-SNAPSHOT.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.github.goooler.osgi</groupId>
  <artifactId>io.github.goooler.osgi.gradle.plugin</artifactId>
  <version>0.8.3-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>A legacy osgi plugin in Gradle 5</name>
  <description>A fork of https://github.com/blindpirate/gradle-legacy-osgi-plugin</description>
  <dependencies>
    <dependency>
      <groupId>io.github.goooler.osgi</groupId>
      <artifactId>gradle-legacy-osgi-plugin</artifactId>
      <version>0.8.3-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

We can see licenses, developers, and scm info are missing in the POM file. Try to publish to Central repo and close it, with same error:

image

GNPP version: 2.0.0-rc-1 You can repro this at https://github.com/Goooler/gradle-legacy-osgi-plugin.

szpak commented 4 months ago

Are you saying that GNPP doesn't support the publication of plugin marker artifacts?

Sorry, I misunderstand you at the first place. I was thinking about publishing GNPP to Maven Central itself (which is also missing).

I dimly remember, I had problems in the past with testing some SNAPSHOT versions of some plugins (published to MavenLocal) and I had to manually add "market artifacts" to make it work. Nevertheless, I would need to dig more into the topic.

Maybe it is to late, but to be on the same page, you would like GNPP to "support" publishing marker artifacts when used in a Gradle plugins, or rather to have GNPP's own marker artifacts to be published?

Goooler commented 4 months ago

Initially, I requested that GNPP's own marker artifacts to be published. I was trying to repro if GNPP correctly supports publishing marker artifacts, seems not. Probably we should file a new issue about "Support publishing plugin marker artifacts".