Search code examples
grailspluginspublishgrails-pluginbintray

Grails (3.0.8) plugin bintrayUpload returns HTTP/1.1 - forbidden


bintrayUpload always try to publish my plugin to grails/plugins instead my repo danieltribeiro/plugins. And I got a 403 forbidden because of that.

* What went wrong:
Execution failed for task ':bintrayUpload'.
> Could not create package 'grails/plugins/my-plugin': HTTP/1.1 403 Forbidden [message:forbidden]

I checked the answer here to a similar problem NullPointerExcpetion and tried all the solutions proposed without lucky. Including the Graeme Rocher Answer just changing the name and leaving userRepo in blank. But no matter what I do the task aways try to upload to grails.plugins repo.

My bintray plugin is 1.2

plugins {
    id "io.spring.dependency-management" version "0.5.2.RELEASE"
    id "com.jfrog.bintray" version "1.2"
}

I tried a lot of configs inside bintray closure on build.gradle following the Benoit tutorial. I created the plugins repo, configured env vars BINTRAY_USER and BINTRAY_KEY with correct values (otherwise it throwns a 401-Unauthorized)

Here is my last (not working) configuration.

version "0.1-SNAPSHOT"
group "danieltribeiro.plugins" // Or your own user/organization

bintray {
  pkg {
    userOrg = 'danieltribeiro' // If you want to publish to an organization
    repo = 'plugins'
    name = "${project.name}"
    //issueTrackerUrl = "https://github.com/benorama/grails-$project.name/issues"
    //vcsUrl = "https://github.com/benorama/grails-$project.name"
    version {
      attributes = ['grails-plugin': "${project.group}:${project.name}"]
      name = project.version
    }
  }
}

Why this task continues to POST to grails.plugins?


Solution

  • Probally you are using:

    apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle'
    

    It take the default bintray config.

    Override this config or comment it and do manually:

    bintray {
        user = 'user'
        key = '*****'
        pkg {    
            userOrg = '' // 
            repo = 'nameRepo'
            licenses = project.hasProperty('license') ? [project.license] :['Apache-2.0']
            name = "$project.name"
            issueTrackerUrl = "yourGitHub"
            vcsUrl = "yourGitHub"
            version {
                attributes = ['grails-plugin': "$project.group:$project.name"]
                name = project.version
            }
        }
    }