Andrew Oberstar

Quick Gradle Tip - Setting Bintray Attributes for Gradle Plugins

September 28, 2014

As part of the new Gradle plugin portal, you need to set some attributes on the version of your plugin package in Bintray.

The Bintray Gradle plugin lets you set attributes, so you can add the following snippet into your project to include all of your plugin IDs in the attributes.

Since Gradle requires you to put a properties file in your JAR for each plugin, you can get derive your whole attribute value from the project's group, name, and the names of the properties files within META-INF.

def pluginIds = project.fileTree(
    dir: 'src/main/resources/META-INF/gradle-plugins',
    include: '*.properties').collect { file ->[0..('.') - 1)] }

bintray {
    // ...
    pkg {
        // ...
        version {
            // ...
            attributes = ['gradle-plugin': pluginIds.collect { pluginId ->
                "${pluginId}:${}:${}" }]

Recent Posts