Project with the configuration that can publish binary Gradle plugin to Gradle Plugin Portal.
Gradle Plugin Portal, is a centralized, searchable repository dedicated to Gradle plugins.
In order to prepare the project for publishing it to Gradle Plugin Portal you have to make sure you add following configuration:
-
Make sure you have a Gradle Plugin Portal account, which can be set up at a login/registration page, and create key and its secret for the API access. Alternatively to creation of API keys manually you can later use gradle login task that will guide you through the process of setting up keys.
-
Save Gradle Plugin Portal key and secret to
~/.gradle/gradle.properties
:
gradle.publish.key=...
gradle.publish.secret=...
- In project apply com.gradle.plugin-publish plugin.
plugins {
id "com.gradle.plugin-publish" version "1.2.0"
}
- Verify that you have
description
set in specificplugins{}
extension block that is of type PluginDeclaration. The group part in ID will have to match with your email or user name. In new version of Gradle and plugin-publish plugin also specify metadata inside of gradlePlugin block (no pluginBundle extension anymore). So be sure you applywebsite
,vcsUrl
andtags
properties for the plugin.
gradlePlugin {
website = "https://github.com/rivancic/gradle"
vcsUrl = "https://github.com/rivancic/gradle" // has to point to the root of the repository
plugins {
create("filesPlugin") {
id = "com.rivancic.files-plugin"
displayName = "Files Sorting Plugin"
description = "Plugin that can sort provided files based on a particular rule (alphabetically, creation date, extension)"
implementationClass = "com.rivancic.gradle.plugin.files.FilesPlugin"
tags.set(["files", "sorting"])
}
}
}
With publishPlugins
task you can publish your plugin to Gradle Plugin Portal. As describe in the tutorial for publishing
for the first time you might wait a day or two that the plugin will be approved. In case your submission is not complete you
will receive an email with detailed explanation of what additional steps are necessary.
Plugin is being published on Gradle Plugin Portal as com.rivancic.files-plugin
Publishing Plugins to the Gradle Plugin Portal (Gradle Userguide)
How do I publish my plugin to the Plugin Portal? (Gradle Plugin Portal)