Closed tcfurrer closed 5 years ago
I think Java 9+ projects are treated as modular but I have to check a few things (though only tomorrow, since it is pretty late now) to determine what can be done about this.
I have the same issue. I've just set the source level to 1.8 in the project properties for now and it's mostly fine.
Given #406, I'm almost certain that issue is solvable (at least to some degree) on the plugin's side. However, I'm not sure what should be used to detect that a Java 9 project in non-modular. In theory I could check for the presense of module-info.java. However, almost certain that that would have adverse effect on the performance because then every time NB queries the module classpath, I have to search the source roots for that (and there are some other issues).
Another solution is to have a project (+global) property which can be used to turn off module related stuff. Altough, I'm guessing that switching between these modes would work properly only after an NB restart. Would this be all right?
Yes, that solution is actually what I was expecting. Manual control can get the job done. Projects will rarely need to change this mode, so restoring functionality for non-modular projects is much more important than the conveniences of auto-detection and dynamic toggling.
+1
+1
Is this fix relatively simple? Assuming so, could there be a release with this within the next couple of weeks or so?
In the meantime, do you need help testing it? I could test your changes against my projects, if that helps.
Yes, this fix should be relatively simple, though requires a little guess work, because I'm not 100% sure (though have a pretty good guess) which part of the API is enough for NB to ignore modules. If nothing unexpected happens, I will have a lot of time next week.
As for testing: If you can share a simple project with which it is easy to validate, if the fix works or not, that would be awesome.
You got it!
Here's a simple project that demonstrates this issue: https://github.com/tcfurrer/tiny-nonmodular-java11-project
This project builds cleanly from gradle cmdline, but Netbeans shows "package exists in another module" on ClassA in nonmodularSubproject1.
I created this with: Netbeans 10 + Gradle 5.0 + Plugin 2.0.1 + OpenJDK 11 + Windows
Any updates here?
Hopefully tomorrow (though I have some other things scheduled tomorrow as well but I think I should have a 2 hours gap) I'll get some time to do this (I have been prioritizing some other things this week).
I pushed the changes to master. Can you check if it works for you? You can find the settings both in the global settings and in the project properties.
Awesome. Yes, I should be able to test it by Monday (if not before).
@kelemen I've tried it and it works for my issue #406
It is working perfectly for me on both my fake tiny project and my local large multi-project build. Thanks!
Can you make a release next?
Soonish, though I had to drop support for Gradle version older than 2.6 because I need the new Tooling API to support 5.0 which does not support older versions.
It should be up now. It is awaiting verification but in the mean time, you can download it manually. Either from GitHub's release page or from the Plugin Portal.
I'm struggling to get my existing multi-project build to work correctly in Netbeans under Java 11.
The only issue is that the Netbeans static code analysis is highlighting almost every class red because it thinks there are compilation errors, when really there aren't any.
Everything works fine when I build, run tests, launch the app, etc from either the gradle cmdline, or from within the Netbeans GUI. This rules out a lot of potential problems.
My setup is: Gradle 5.0-rc3 openjdk11 Netbeans 10 vc3 Gradle Netbeans Plugin 2.0.1 (Tried same on both Windows and Linux)
My subprojects haven't been refactored into Java Modules yet. They still have several overlapping packages, but this should be allowed because my gradle build is set up to use classpath and not modulepath for all subproject dependencies.
However, I'm seeing "package exists in another module" errors coming from Netbeans. Apparently Netbeans thinks my subprojects are Java Modules, or else this wouldn't be happening. I'm unclear on whether this is a problem with the new version of Gradle, the new version of Netbeans, the Netbeans Gradle Plugin, or something I'm doing wrong.
I poked around for a few hours on this, and I'm still stuck.
Is there something special I can do in order to control whether my subprojects get treated as Java Modules from Netbeans point of view?
(Apologies for the distraction if this ends up being a Netbeans or Gradle issue, and not a Netbeans Gradle Plugin issue... right now I'm totally unsure where the root cause lies.)