-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error on import statements of test classes using module-info #417
Comments
Can you try using somethine else than the default package? |
Thanks for the report and the sample project, I will have a look next week (or maybe sunday), as I'm on holiday at the moment. |
Have a nice holiday! |
…his seems to fix the issue #417 (module-info.java not being recognized for test source sets) but I don't actually now what NB is doing, and this change just mimics the behaviour of the Maven integration.
I have made some adjustment to better mimic what the Maven integration does. However, I'm a little puzzled on what actually NB is doing to use the module-info.java from the main source set. However, the recently pushed changes seems to fix the issue for me. Can you try building the master branch and see if it works for you? |
I will try and write my feedback here :-) |
I build the master branch with your changes and verified the behavior. Sadly it did not change anything for me. In the class "PropertyChangeListenerTests" the "import java.beans" are highlighted again as error with the same tooltip "package java.beans does not exists". If we make an appointment, i can share you my screen over skype, so that you can verify what I have done. Have you tried opening the attached project in "gradleJava.zip" with your changes? |
I have checked this with your attached project. To be honest I closed the file and then the project, restarted NB and opened the project again (that said, this hints to a very unreliable behaviour). No need to share your screen, I believe you and you shouldn't really be able to do the wrong thing. It seems I will have to check some other things. That said, the current development version of NB has a completely different Gradle integration packaged. I recommend you building NB from the sources (https://github.com/apache/incubator-netbeans), it is pretty easy to build (though takes a while), and see if that works for you first. |
I have cloned and build incubator-netbeans like you recommended. Bad news, now the import-statement of "import org.junit.Test;" is now shown as error, with the message "package org.junit is not visible ...", but maybe this behavior is correct and I have to do some more configuration in netbeans? Any hint or tips for me? |
I had a brief look at the source code, and it seems that it misses an implementation of Anyway, you should report issues of that plugin here: https://issues.apache.org/jira/projects/NETBEANS/issues |
I have found an already created issue for this error: Maybe if we can get in touch with a developer from netbeans knowing the relevant module/code, the solution/knowledge found out can be relevant or helpfull for fixing both issues, your plugin and the incubator-netbeans gradle integration. |
I have already talked about this with an NB developer but it seems I did not quite understood what is to do properly. Anyway, I will try harder to analize the sources of NB a little harder but I'll probably only have time on the weekend. |
I went through some NB and nb-javac sources on the weekend but it seems a little odd to me because - though I probably missed something - the only way I saw to tell NB to use the main's module-info.java in test is to have them on the same source path but I remember that doing so causes other weird issues (not to mention that the Maven integration does not do that). I will need more time for this (something I have little of at the moment). |
Thanks for you patience for further investigation. Hope that this issue will also be fixed in the incubator-netbeans. Can I do something to support them? |
Could not setup simple java gradle project with module-info.java and tests without error using java 11.
Netbeans gradle shows me error on import statements of test-classes using java jigsaw module-info.
Simple gradle Java project with:
gradleJava/src/main/java/module-info.java:
gradleJava/src/test/java/PropertyChangeListenerTests.java:
Netbeans shows the line "import java.beans.PropertyChangeListener;" as error:
"package java.beans" does not exist.
Expect that netbeans-grade plugin uses module-info.java of src/main for src/test and does not show the error on the import statements of the test.
I want to use different locations src/main for source code and src/test for unit tests.
I tried it in IntelliJ and there it works as expected.
Screenshot of error in netbeans:
Simple sample project for opening in netbeans to show the error:
gradleJava.zip
The text was updated successfully, but these errors were encountered: