NetBeans/Gradle Integration Problems

I'm encountering a problem for which there appears to be no solution. I even reimplemented the earlier prototype so that I now have no child nodes below the build.gradle, instead I have a Navigator showing the Gradle tasks, where you can click a task to run it.

However, despite that, a crucial problem remains: whenever I run certain important method calls from the Gradle Tooling API... the NetBeans editor suddenly empties, not only for the current document, but for all documents that had not yet been opened:

Though the content of the file is still present, on disk, the editor document is suddenly empty. That specifically happens when "BuildableProject.getTasks" is run, which is crucial in identifying the tasks in the build.gradle, as well as "BuildLauncher.forTasks", which is the command for running a task. I.e., both these calls are vital, of course, since if you can't identify tasks in the project and if you can't run them either (because the NetBeans editor suddenly empties completely for no apparent reason), well, then what's the point of using Gradle in NetBeans.

So, hoping that a Gradle expert or someone using the Gradle Tooling API can point out what the problem is. Threading? Gradle daemon? Classloading? You tell me.


Check a thread dump. The NB editor generally loads document content asynchronously and it is conceivable that something has interrupted that task so that the document remains empty.

Posted by Jesse Glick on September 08, 2011 at 09:49 AM PDT #

looks not like a gradle issue to me. but its hard to suggest anything without looking at the sourcecode.

Posted by mbien on September 08, 2011 at 11:03 AM PDT #

I've been involved in the tooling api and I'll try to help :)

As far as I understand you are able to build the model (BuildableProject) using the tooling api. The problem with disappearing editors manifests when you call getTasks() method, right?

Building the model via tooling api spins a new process in the background (daemon) but I don't think it should upset NetBeans. There's some communication over the socket between the vm with tooling-api and the daemon, this communication stops when the model is build. The tooling api does not change/update the contents of build files.

What are the steps to reproduce the issue with netbeans? It feels that netbeans & gradle interfere somehow.

BTW. can you file a jira ticket for it in the gradle tracker? That would make it more visible to gradle experts than a blog post :) You can put the steps to reproduce in the jira ticket.


Posted by Szczepan Faber on September 08, 2011 at 11:18 PM PDT #

Hi Szczepan, thanks for looking into this. I added my thoughts to this existing issue:

Personally, I'd rather have no external process at all.

Posted by Geertjaan on September 09, 2011 at 02:24 AM PDT #

Hi Geertjaan!

Where I could find the source code of the plugin?

Posted by Alexander Nuikin on November 14, 2011 at 11:08 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016