Configuration on demand prevents the Tooling API from loading models

(Attila Kelemen) #1

When using the Configuration on demand feature in 1.4-rc-3 and attempting to load a model (via ‘ModelBuilder.get()’), the Tooling API blocks and waits indefinitely. I tried the feature by specifing ‘’ in I’m currently using version 1.0 of the Tooling API. Executing tasks through the Tooling API seems to work however.

Here are the logs produced by the daemon: And here is the verbose console output:

Another interesting thing is that if I interrupt (‘Thread.interrupt’) the thread executing the ‘ModelBuilder.get()’ call, the method call throws an NPE:

 at org.gradle.tooling.internal.consumer.protocoladapter.TargetTypeProvider.getTargetType(
 at org.gradle.tooling.internal.consumer.protocoladapter.ProtocolToModelAdapter.adapt(
 at org.gradle.tooling.internal.consumer.DefaultModelBuilder$ProtocolToModelAdaptingHandler.onComplete(
 at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onComplete(
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$
 at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
 at java.util.concurrent.ThreadPoolExecutor$
[catch] at

EDIT: I have verified this problem using the Tooling API 1.4-rc-3.

EDIT2: I have tested this problem with Eclipse, Idea and NetBeans:

  • Eclipse: It seems to use the version specified by the wrapper and if “Configuration on demand” is enabled and Gradle 1.4-rc-3 is set for the wrapper, it will wait endlessly when importing the project. It is a very serious problem for Eclipse because at this point the only thing you can do is to kill Eclipse, not even killing the Gradle daemon helps. - Idea: Idea seems to use Gradle 1.1 no matter what, so this problem does not affect Idea. - NetBeans: It is possible to configure what Gradle version you plan to use, but if you configure it to load a project using 1.4-rc-3, NB will load the project in the background forever. You can cancel the project loading (which will interrupt the thread loading the model, reporting the thrown NPE mentioned above) and you can continue working, but of course, the project remains unloadable with 1.4-rc-3.


This is a known issue that won’t be fixed for the 1.4 release. However, you can try out the latest Gradle Nightly, where this issue should have been resolved.

(Attila Kelemen) #3

I have checked the latest nightly and it seems to work ok. However, it would be nice to also allow to apply configuration on demand even in the case of model loading. I have opened an RFE for this.


Thanks for checking it out for us. I’ll make sure that your request makes it to the developer doing this work.