Search code examples
gradlereleasepublishpom.xmlbintray

Publishing artifact from gradle project to bintray (maven repository)


I have configured Gradle to publish project artifact using new Maven Publisher Plugin, unfortunately this plugin has problem with dependency in generated pom.xml - dependencies has scope runtime instead of compile.

My configuration is like this:

apply plugin: 'maven-publish'

publishing {
    publications {
        mavenCustom(MavenPublication) {
            from components.java
        }
    }
    repositories {
        maven {
            url "https://api.bintray.com/maven/codearte/public/fairyland"
            credentials {
                username = bintrayUser
                password = bintrayKey
            }
        }
    }
}

Publishing was simple with one command:

gradle publish

How to achieve this in old (working) way? Is possible to automate project taging when project is released?


Solution

  • Ok, I figured it out:

    apply plugin: 'maven'
    
    uploadArchives {
        repositories {
            mavenDeployer {
                name = 'Codearte Public Repository'
                repository(id: 'codearte-repository', url: 'https://api.bintray.com/maven/codearte/public/fairyland'){
                    authentication(userName: bintrayUser, password: bintrayKey)
            }
        }
    }
    

    Uploading with command:

    gradle uploadArchives