kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
172 stars 57 forks source link

Gradle projects are parsed by Gradle but are not opened in NetBeans #381

Open mweisshaupt1988 opened 6 years ago

mweisshaupt1988 commented 6 years ago

I have a strange Issue with NetBeans 9 and the recent Gradle plugin.

While working on another project I get the warning that parsing a different project fails. But neither is the project opened in NetBeans nor is it referenced in any build script in the current project.

I suspect that it is somewhere cached in the NetBeans configuration. I don't think that it is desirable to parse projects that are not opened in NetBeans.

kelemen commented 6 years ago

This is an NB thing. It is just NB requests some info about the project for which the plugin need to evaluate it. If you think it shouldn't, you may look at the IDE logs (view / IDE log) and look for a message Activating project ({0}) lookup due to requesting: {1}. If {1} is "ClassPathProvider.findClassPath" then you are probably out of luck because I must tell NB the classpath (to keep the contract of the API) and I can only do so by evaluating the scripts. If it is not, then I might be able to reduce the "unnecessary" project load.

Also, it would be very inconvenient if only projects that are opened are loaded because then you would have to open all the dependency projects as well otherwise the edito would not work. Anyway, this is an NB thing and - for the most part - I can't do anything about.

mweisshaupt1988 commented 6 years ago

Thank you for your answer. I'm afraid this is exactly the problem.

Here is the IDE log with some obfuscation of my project details: NetBeans_Log.txt

I meant of course that dependencies should be loaded but projects that are not related in any way should not. In this case the project is not even from the same directory. While working on a Java EE project it should not load any Android projects :D

BTW: The springboottest application should not be opened as well. But this one does not fail so I didn't even notice it.

Do you think it would be helpful if I posted this to the NetBeans mailing list?

kelemen commented 6 years ago

A general request is probably futile because it could easily lead to a complete rewrite of NB. However, if you could find specific problems, then that might be addressable. It is not necessarily easy to find these things though. If you want to give it a try, you can modify the plugin to print the whole stack trace where the project was forced to be activated in ProjectLookupHack (say, you could print a newly created exception in the logs and see if it is of any use).