Quantcast

Publishing using maven-publish plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Publishing using maven-publish plugin

Rish
This post has NOT been accepted by the mailing list yet.
Hi,

For a build system that we are trying to move to gradle; we are looking to use the maven-publish plugin as defined in an init script. Essentially the execution looks like the following:

gradle clean build publish -I maven_publish.gradle

in our build system.

The contents of maven_publish.gradle look like the following:

allprojects {

apply plugin: 'maven-publish'

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
    repositories {
        maven {
            credentials {

                //authentication(userName: mavenUsername, password: mavenPassword)
                username repoUsernameProp
                password repoPasswordProp
            }


            if(project.version.endsWith('-SNAPSHOT')) {
                url "http://my-repo/SNAPSHOTS"
            } else {
                url "http://example/artifactory/libs-release-local"
            }
        }
    }
}

}



The above approach works perfectly fine when its used for a single module project. However, for a multi-module gradle project, the above approach throws the following error:

A problem occurred configuring root project 'universal-thrift-proxy'.
> Could not find property 'java' on SoftwareComponentInternal set.

We do not want to expose this script to the rest of the org (we do not want ppl to be uploading artifacts to central repo from their machines than the build farm); hence we are not using an "apply from" mechanic which works fine.

Any suggestions would be really helpful.

Thanks,
Rish
Loading...