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?

有帮助吗?

解决方案

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

其他提示

The fact that all POM dependencies have runtime scope is a known limitation of the new, incubating maven-publish plugin. Until this gets fixed, you can either fix it up yourself by using the publication.pom.withXml hook, or fall back to the maven plugin. Both plugins are documented in the Gradle User Guide.

Tagging is an entirely different question. You can either use one of the third-party Gradle SCM plugins or call out to a command line tool (e.g. with an Exec task).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top