X

Geertjan's Blog

  • September 8, 2011

NetBeans/Gradle Integration Problems

Geertjan Wielenga
Product Manager

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.

Join the discussion

Comments ( 5 )
  • Jesse Glick Thursday, September 8, 2011

    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.


  • mbien Thursday, September 8, 2011

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


  • Szczepan Faber Friday, September 9, 2011

    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.

    Thanks!


  • Geertjaan Friday, September 9, 2011

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

    http://issues.gradle.org/browse/GRADLE-1594

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


  • Alexander Nuikin Tuesday, November 15, 2011

    Hi Geertjaan!

    Where I could find the source code of the plugin?


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.