Subproject dependencies fail when publishing task is used


(Alexandru Ionita) #1

If a subproject (named dolphin in our case) depends on another subproject (called dolphlib) and that is marked as
compile project(':dolphlib')

and in the same subproject (dolphin) we also have a publishing task


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

, the project will fail with this error:

A problem occurred configuring project ':dolphin'.
> Failed to notify project evaluation listener.
   > A problem occurred configuring project ':dolphlib'.
      > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
   > A problem occurred configuring project ':dolphlib'.
      > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
   > A problem occurred configuring project ':dolphlib'.
      > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.

Gradle Version: 2.14
Operating System: UNIX
Is this a regression? If yes, which version of Gradle do you know it last worked for?


(Dmitry Vyazelenko) #2

I’ve just had the same problem after upgrading to Gradle 2.14 and also upgrading to latest Artifactory plugin (i.e. org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0). If I switch back to Arifactory 4.3.0 plugin then everything works.


(Stefan Wolf) #3

Thanks for your report.

Could you provide a little bit more detail like a stacktrace (running gradle -s) and the plugins involved?

Thank you,
Stefan


(Trejkaz (pen name)) #4

We get this on ours too, which also started after updating to Gradle 2.14. Here’s our stack:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':bootstrap'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)
        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
        at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:55)
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:221)
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:209)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
        ... 52 more
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':common'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:49)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)
        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)
        at org.gradle.api.publish.internal.ProjectDependencyPublicationResolver.resolve(ProjectDependencyPublicationResolver.java:35)
        at org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.addProjectDependency(DefaultMavenPublication.java:120)
        at org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.from(DefaultMavenPublication.java:111)
        at build_3ozpq55avq3rlnb3nzqztdm63$_run_closure2$_closure25$_closure30$_closure31.doCall(/Data/Projects/nuix/trunk-clean/product/build.gradle:231)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
        at org.gradle.api.internal.AbstractPolymorphicDomainObjectContainer.create(AbstractPolymorphicDomainObjectContainer.java:65)
        at org.gradle.api.internal.PolymorphicDomainObjectContainerConfigureDelegate._configure(PolymorphicDomainObjectContainerConfigureDelegate.java:44)
        at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:68)
        at build_3ozpq55avq3rlnb3nzqztdm63$_run_closure2$_closure25$_closure30.doCall(/Data/Projects/nuix/trunk-clean/product/build.gradle:230)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:149)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:70)
        at org.gradle.api.internal.AbstractNamedDomainObjectContainer.configure(AbstractNamedDomainObjectContainer.java:25)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:59)
        at org.gradle.api.publish.internal.DefaultPublishingExtension.publications(DefaultPublishingExtension.java:48)
        at org.gradle.api.publish.internal.DefaultPublishingExtension_Decorated.publications(Unknown Source)
        at build_3ozpq55avq3rlnb3nzqztdm63$_run_closure2$_closure25.doCall(/Data/Projects/nuix/trunk-clean/product/build.gradle:229)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
        at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
        at org.gradle.api.internal.plugins.ExtensionsStorage$DeferredConfigurableExtensionHolder.configureNow(ExtensionsStorage.java:183)
        at org.gradle.api.internal.plugins.ExtensionsStorage$DeferredConfigurableExtensionHolder.get(ExtensionsStorage.java:162)
        at org.gradle.api.internal.plugins.ExtensionsStorage.getByType(ExtensionsStorage.java:77)
        at org.gradle.api.internal.plugins.DefaultConvention.getByType(DefaultConvention.java:113)
        at org.jfrog.gradle.plugin.artifactory.task.helper.TaskHelperPublications.publications(TaskHelperPublications.java:79)
        at org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask.publications(ArtifactoryTask.java:89)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:374)
        at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:169)
        at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
        at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
        at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:59)
        at build_3ozpq55avq3rlnb3nzqztdm63$_run_closure3$_closure49$_closure52.doCall(/Data/Projects/nuix/trunk-clean/product/build.gradle:372)
        at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:67)
        at org.gradle.util.ConfigureUtil.configureSelf(ConfigureUtil.java:137)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:522)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:76)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
        at org.jfrog.gradle.plugin.artifactory.task.BuildInfoBaseTask.projectsEvaluated(BuildInfoBaseTask.java:178)
        at org.jfrog.gradle.plugin.artifactory.task.BuildInfoBaseTask$projectsEvaluated.call(Unknown Source)
        at org.jfrog.gradle.plugin.artifactory.extractor.listener.ProjectsEvaluatedBuildListener$_afterEvaluate_closure1.doCall(ProjectsEvaluatedBuildListener.groovy:43)
        at org.jfrog.gradle.plugin.artifactory.extractor.listener.ProjectsEvaluatedBuildListener.afterEvaluate(ProjectsEvaluatedBuildListener.groovy:42)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:249)
        at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:229)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        ... 67 more
Caused by: java.lang.IllegalStateException: Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.startNotification(DefaultListenerManager.java:170)
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast.access$300(DefaultListenerManager.java:112)
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:219)
        at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:209)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy11.beforeEvaluate(Unknown Source)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
        at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
        at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy11.beforeEvaluate(Unknown Source)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:47)
        ... 114 more

Plugins on ours:

subprojects {
  apply plugin: 'idea'
  apply plugin: 'eclipse'
  apply plugin: 'maven'
}

allprojects {
  apply plugin: 'java'
  apply plugin: 'maven-publish'
  apply plugin: 'com.jfrog.artifactory'
  apply plugin: 'license-report'
  apply plugin: 'de.thetaphi.forbiddenapis'
}

There are duplicates across the two but I tried removing the duplicates and that doesn’t stop it happening.


(Dmitry Vyazelenko) #5

I’ve created a reproducer project https://github.com/vyazelenko/gradle-artifactory-bug. I simply try to run:
gradlew tasks I get the following output:
` 100FAILURE: Build failed with an exception.

* Where:
Build file 'P:\Projects\oss\gradle-artifactory-bug\build.gradle' line: 21

* What went wrong:
A problem occurred configuring project ':foo-client'.
> Failed to notify project evaluation listener.
> A problem occurred configuring project ':foo-common'.
  > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
> A problem occurred configuring project ':foo-common'.
  > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
> A problem occurred configuring project ':foo-common'.
  > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.
> A problem occurred configuring project ':foo-common'.
  > Cannot notify listeners of type ProjectEvaluationListener as these listeners are already being notified.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.`

The problem goes away if i change org.jfrog.buildinfo:build-info-extractor-gradle:4.4.0 to org.jfrog.buildinfo:build-info-extractor-gradle:4.3.0 or I remove dependencies between project modules, i.e. comment out dependency on :foo-common module in foo-server and foo-client modules.


(Paul Merlin) #6

Hi Alexandru, Trejkaz and Dimitry,

Thanks for the report and especially for the reproducer project.

This does not look like a regression in Gradle 2.14.
The reproducer project fail since Gradle 2.6, it works with Gradle 2.5.

But if you downgrade org.jfrog.buildinfo:build-info-extractor-gradle from 4.4.0 to 4.3.0 then it works from Gradle 2.0 to Gradle 2.14.

I filled an issue on JFrog’s plugin that you can watch.