#StackBounty: #gradle #artifactory #snapshot #bintray #maven-publish Publish Snapshot to oss.jfrog.org with multiple modules fails with…

Bounty: 400

I’m trying to publish a project with multiple modules to artifactory (oss.jfrog.org). When I run artifactoryPublish I get a 403 error but I know it’s not a permissions issue because it works with a single module. It only fails trying publish multiple modules.

Some modules are aars and others are jars and all include sources. I can publish them all to Bintray, but can’t publish to artifactory (for snapshots).

So the question is, how do I configure a multi-module project to publish snapshots to oss.jfrog.org.

I’ve figured out that if I change it to publish a single module and make the artifact name the same as the last part of the group, it works, but a different name doesn’t work (gives 403 error).

So if group is com.example.foo I can publish foo.jar (com/example/foo/foo/1.0.0-SNAPSHOT/foo-1.0.0.jar). But I can’t publish bar.jar (com/example/foo/bar/1.0.0-SNAPSHOT/bar.jar).

This gradle is included in every project’s build.gradle

afterEvaluate {
    publishing {
        publications {
            mavenPublication(MavenPublication) {
                artifact sourcesJar
            if (project.plugins.hasPlugin("com.android.library")) {
            } else {
            groupId "com.example.foo"
            artifactId project.name // changing this to "foo" works for a single project
            version version
            pom {

                packaging POM_PACKAGING
                version version

                licenses {
                    license {

                developers {
                    developer {

                    scm {

    bintray {
        user = project.findProperty('bintrayUser') ?: System.getenv('BINTRAY_USER')
        key = project.findProperty('bintrayApiKey') ?: System.getenv('BINTRAY_API_KEY')
        configurations = ['archives']
        publish = true
        dryRun = true
        pkg {
            name = project.name
            repo = BINTRAY_REPO
            userOrg = BINTRAY_ORG
            licenses = [POM_LICENSE_NAME]
            vcsUrl = POM_SCM_URL
            version {
                name = project.name
                released = new Date()

    artifactory {
        contextUrl = 'http://oss.jfrog.org'
        publish {
            repository {
                repoKey = 'oss-snapshot-local'
                username = project.findProperty('bintrayUser') ?: System.getenv('BINTRAY_USER')
                password = project.findProperty('bintrayApiKey') ?: System.getenv('BINTRAY_API_KEY')
            defaults {
                publishArtifacts = true
                publishPom = true
        resolve {
            repoKey = 'jcenter'

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.