Publish commercial plugins to the Gradle Plugin portal

How can one publish commercial (closed source, but freely available) plugins to the plugin portal?

Hi Axel!

The publishing plugin publishes any artifacts that are part of the archives configuration.

Currently the publishing plugin will add default sources, javadoc and potentially groovydoc artifacts to the archives configuration if it looks like that configuration is in some sort of default state (ie there is only the jar artifact).

We will look at adding a flag to suppress this behaviour for commercial plugins, but in the meantime you’ve got a couple of options:

  1. Configure some of those artifacts yourself. e.g. if you configure a javadoc artifact, the plugin will realise that you’re doing something non-standard and won’t add anything.

  2. Add the following code after applying the publishing plugin to remove any artifacts that you don’t want to publish:

project.afterEvaluate {
  def sourcesJarArtifact = configurations.archives.artifacts.find { it.classifier == 'sources' }
  if(sourcesJarArtifact) {
    configurations.archives.artifacts.remove(sourcesJarArtifact)
  }
}

Hope that helps

Thank you for your suggestion Tom, but there is actually more than meets the eye. The big issue is the exclusive reliance on Bintray. To publish an commercial artifact on Bintrayone must purchase a commercial Bintray plan (https://bintray.com/account/pricing?tab=account&type=pricing). This is several orders of magnitude more expensive than say to host it on S3.

So how can I publish a plugin from a different source than Bintray?

Hi Axel,

Good news on this front, if you use the new Plugin Publishing plugin, then this bypasses Bintray altogether. We are hosting all plugins published to the portal on plugins.gradle.org. Builds that aren’t using the plugins { } block need to have this repository in their buildscript definition, and this appears when you lookup any plugin on the portal.

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }

Let us know if you have any more questions

Best Regards

Kon

BIG WARNING!!! the code snippet above DOES NOT STOP THE PUBLISHING PLUGIN FROM UPLOADING THE SOURCES!!!

(tested only with the new plugin only.)

gradle should update or delete that misleading post ASAP.

the code i used in my build script is:

afterEvaluate {
    def archivesArtifacts = configurations.archives.artifacts
    archivesArtifacts.removeAll archivesArtifacts.findAll { it.classifier }
}

which acts on all artifacts that have a classifier. this works and makes gradle assemble produce only one jar (instead of 4), the one with the compiled classes. however if you invoke gradle publishPlugins, then the 4 artifacts be produced anyway and immediately uploaded to the world!

disable the 3 tasks that produce the unwanted jars before publishing!