Enabling ConfigureOnDemand breaks implicit POM generation dependency tasks necessary for MavenPublication

I think I hit a strange bug that is related to configureOnDemand option.

In the failure mode, Gradle does not run the “generatePomFileFor*” tasks when configureOnDemand is true. If I run ‘gradle tasks --all’, all of the “generatePomFileFor*” tasks are correctly show as a dependency of the artifactoryPublish tasks. However, running artfiactoryPublish task will fail with a error that the POM file does not exist. Everything works correctly if configureOnDemand is set to false.

I have only tested this with gradle 1.10.

The output with “configureOnDemand” enable:

Selected primary task 'publish'
All projects evaluated.
Tasks to be executed: [task ':resources:artifactory:artifactoryPublish', task ':resources:artifactory:publish']
:resources:artifactory:artifactoryPublish (Thread[Daemon Thread 6,5,main]) started.
:resources:artifactory:artifactoryPublish
Executing task ':resources:artifactory:artifactoryPublish' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
:resources:artifactory:artifactoryPublish FAILED
:resources:artifactory:artifactoryPublish (Thread[Daemon Thread 6,5,main]) completed. Took 0.001 secs.

The output with “configureOnDemand” disabled:

All projects evaluated.
Selected primary task 'publish'
Tasks to be executed: [task ':resources:artifactory:generatePomFileForApplet-launcherPublication', task ':resources:artifactory:generatePomFileForAxis-jaxrpcPublication', task ':resources:artifactory:generatePomFileForBcmPublication', task ':resources:artifactory:generatePomFileForBipluginsPublication', task ':resources:artifactory:generatePomFileForCeaspectPublication', task ':resources:artifactory:generatePomFileForCecorePublication', task ':resources:artifactory:generatePomFileForCelibPublication', task ':resources:artifactory:generatePomFileForCesessionPublication', task ':resources:artifactory:generatePomFileForChartfx-annotationPublication', task ':resources:artifactory:generatePomFileForChartfx-mapPublication', task ':resources:artifactory:generatePomFileForChartfxPublication', task ':resources:artifactory:generatePomFileForCorbaidlPublication', task ':resources:artifactory:generatePomFileForCryptojFIPSPublication', task ':resources:artifactory:generatePomFileForDetector4Publication', task ':resources:artifactory:generatePomFileForDetectorPublication', task ':resources:artifactory:generatePomFileForEbus405Publication', task ':resources:artifactory:generatePomFileForEjb3-persistencePublication', task ':resources:artifactory:generatePomFileForEl-apiPublication', task ':resources:artifactory:generatePomFileForJai-codecPublication', task ':resources:artifactory:generatePomFileForJavaccPublication', task ':resources:artifactory:generatePomFileForJboss-common-clientPublication', task ':resources:artifactory:generatePomFileForJboss-common-jdbc-wrapperPublication', task ':resources:artifactory:generatePomFileForJboss-ejb3xPublication', task ':resources:artifactory:generatePomFileForJboss-hibernate-validatorPublication', task ':resources:artifactory:generatePomFileForJboss-j2eePublication', task ':resources:artifactory:generatePomFileForJboss-jcaPublication', task ':resources:artifactory:generatePomFileForJboss-jmxPublication', task ':resources:artifactory:generatePomFileForJboss-portal-identityPublication', task ':resources:artifactory:generatePomFileForJboss-systemPublication', task ':resources:artifactory:generatePomFileForJbosssxPublication', task ':resources:artifactory:generatePomFileForJbossweb-servicePublication', task ':resources:artifactory:generatePomFileForJbosswebPublication', task ':resources:artifactory:generatePomFileForJsf-faceletsPublication', task ':resources:artifactory:generatePomFileForJsonPublication', task ':resources:artifactory:generatePomFileForJsp-apiPublication', task ':resources:artifactory:generatePomFileForJxlPublication', task ':resources:artifactory:generatePomFileForLoggingPublication', task ':resources:artifactory:generatePomFileForOpensamlPublication', task ':resources:artifactory:generatePomFileForOracle-jdbc6Publication', task ':resources:artifactory:generatePomFileForRebean-commonPublication', task ':resources:artifactory:generatePomFileForRebean-wi-adapterPublication', task ':resources:artifactory:generatePomFileForRebean-wi-modelPublication', task ':resources:artifactory:generatePomFileForRebean-wi-server-requestsPublication', task ':resources:artifactory:generatePomFileForRebean-wiPublication', task ':resources:artifactory:generatePomFileForRxtx-nativePublication', task ':resources:artifactory:generatePomFileForSL_pluginsPublication', task ':resources:artifactory:generatePomFileForServlet-apiPublication', task ':resources:artifactory:generatePomFileForSpringPublication', task ':resources:artifactory:generatePomFileForTraceLogPublication', task ':resources:artifactory:artifactoryPublish', task ':resources:artifactory:publish']

Hard to say from here what the problem is, but it sounds like an incompatibility between configuration on demand and the Artifactory plugin. Perhaps try without the latter.