Can't set dependOn for maven publish (maven-publish plugin) autogenerated tasks


(platon.tema) #1

I have this build script

apply plugin: 'base'
apply plugin: 'java'
  task coreLibJar(type: Jar) {
 ....
}
  apply plugin: 'maven-publish'
  publishing {
    publications {
        coreLib(MavenPublication) {
            groupId 'org.company'
            artifactId 'core-lib-export'
            version '1.X.X'
              artifact coreLibJar
        }
    }
      repositories {
        maven {
            url 'http://x.x.x.x:8081/<name>/libs-release-local'
                          credentials {
                username = 'XXXX'
                password = 'XXXX'
            }
        }
    }
      publishCoreLibPublicationToMavenRepository.dependsOn ':coreLibJar'
}

and with gradle-1.8 it is worked.

But with gradle-1.9-rc-3 and then 1.9 release i saw

A problem occurred configuring root project 'XXXXX'.
> Could not find property 'publishCoreLibPublicationToMavenRepository' on org.gradle.api.publish.internal.DefaultPublishingExtension_Decorated@1dc4ead.

My first naive solution (project configures with no errors)

gradle.taskGraph.whenReady {
    publishCoreLibPublicationToMavenRepository.dependsOn ':coreLibJar'
}

i have some doubts with it.

Please show me the correct way and\or explain last API changes.