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 ‘systemProp.org.gradle.configuration.ondemand=true’ in gradle.properties. I’m currently using version 1.0 of the Tooling API. Executing tasks through the Tooling API seems to work however.
Another interesting thing is that if I interrupt (‘Thread.interrupt’) the thread executing the ‘ModelBuilder.get()’ call, the method call throws an NPE:
java.lang.NullPointerException at org.gradle.tooling.internal.consumer.protocoladapter.TargetTypeProvider.getTargetType(TargetTypeProvider.java:44) at org.gradle.tooling.internal.consumer.protocoladapter.ProtocolToModelAdapter.adapt(ProtocolToModelAdapter.java:31) at org.gradle.tooling.internal.consumer.DefaultModelBuilder$ProtocolToModelAdaptingHandler.onComplete(DefaultModelBuilder.java:114) at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onComplete(ResultHandlerAdapter.java:40) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:84) at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [catch] at java.lang.Thread.run(Thread.java:662)
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.