uploadArchives is skipped as task onlyIf is false; why?

I am using gradle 2.10 on a multi-module gradle project.
under subProjects, I have defined the following:


    uploadArchives {


        repositories {
            mavenDeployer {
                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

                repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
                        authentication(userName: sonatypeUsername, password: sonatypePassword);
                }

                pom.project {
                    url "http://www.apereo.org/cas"
                    inceptionYear 2004

                    issueManagement {
                        system "Github"
                        url "https://github.com/Jasig/cas/issues"
                    }

                    scm {
                        url 'scm:git@github.com:Jasig/cas.git'
                        connection 'scm:git@github.com:Jasig/cas.git'
                        developerConnection 'scm:git@github.com:Jasig/cas.git'
                    }

                    licenses {
                        license {
                            name 'The Apache Software License, Version 2.0'
                            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                            distribution 'repo'
                        }
                    }

                    developers {
                        developer {
                            id 'leleuj'
                            name 'Jérôme Leleu'
                        }
                    }

                    contributors {
                        contributor {
                            name "Adam Rybicki"
                            email "arybicki@unicon.net"
                        }
                    }

                    mailingLists {
                        mailingList {
                            name "cas-user"
                            subscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-user"
                            unsubscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-user"
                            post "cas-user@apereo.org"
                            archive "https://groups.google.com/forum/#!forum/jasig-cas-user"
                        }
                        mailingList {
                            name "cas-dev"
                            subscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-dev"
                            unsubscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-dev"
                            post "cas-dev@apereo.org"
                            archive "https://groups.google.com/forum/#!forum/jasig-cas-dev"
                        }
                        mailingList {
                            name "cas-announce"
                            subscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-announce"
                            unsubscribe "https://groups.google.com/a/apereo.org/forum/#!forum/cas-announce"
                            post "cas-announce@apereo.org"
                            archive "https://groups.google.com/a/apereo.org/forum/#!forum/cas-announce"
                        }
                    }

                }
            }
        }

    }

In my gradle.properties file I have also define:

signing.keyId=xxxxx
signing.password=xxxxx
signing.secretKeyRingFile=c:\\System\\.gnupg\\secring.gpg

I run the following command at in a submodule directory from the prompt:

 gradle uploadArchives -DpublishReleases=true -DsonatypeUsername=xxxx -DsonatypePassword=xxx --info

Log output tells me:

Skipping task ':module-name:uploadArchives' as task onlyIf is false.

Why? How?

P.S: snapshot releases work correctly

1 Like

Artifacts are defined in the subprojects section as

    artifacts {
        tests testJar

        archives sourcesJar
        archives javadocJar
        archives testJar
    }

None of the artifact names end with SNAPSHOT.

Running the command with --debug also does not tell me much, other than the task is skipped.

  • Can you show the code that handles the system properties you are passing in from the command line?
  • For publishing to SNAPSHOT repos, you should use snapshotRepository instead of repository. If you publishing to release and SNAPSHOT repos then you will need to have both declarations.

The full build is here:

What really confused me was that I was looking for an onlyIf predicate and there was none. I then realized uploadArchives has a dependsOn element in the build where the dependent-upon task attempts to enable/disable the uploadArchives. Removing that piece of code made it work.

The error message should definitely be clearer.

I’d suggest adding some message to the onlyIf predicate that indicates to the user why it behaves the way it does.