Interesting. Gradle had no issue doing a clean build, but ultimately I don’t 
need multiple modules in the same project. So I’ve gone back to not using a 
module name sub folder. NB is happy now. 

I was having a lot of other issues before I decided to try using the module sub 
folder. NB complained about classes not being found from the same project and 
Java.lang.Object not being available. Lots of NB flagging errors that made no 
sense. Something had it confused, but eventually after trying the module sub 
folder to see if that made a difference (it did not) and then going back to no 
module name folder and restarting NB, the situation cleared up. 

Scott

> On Nov 23, 2021, at 11:27 PM, Laszlo Kishalmi <laszlo.kisha...@gmail.com> 
> wrote:
> 
> Well AFAIK standard Gradle does not support that layout. You can add a 
> separate Java project for each java module you are working with in a 
> multi-project Gradle setup. Or if you insist keeping your modules in one 
> project you can always declare one sourceset per module. In that case:
> 
> src/
>   com.example.module_a/
>     java/
>       module-info.java
> 
> Though in that case you need to set up the custom sourcesets in your project 
> (I haven't checked, but I could imagine that there is a third party plugin 
> for that.)
> 
> 
>> On 11/23/21 19:05, Scott Palmer wrote:
>> I just recently started using Java modules.  From what I’ve read, standard 
>> layout for projects with modules is:
>> src/
>>   main/
>>     java/
>>       com.example.module_a/
>>         module-info.java
>>         com/
>>           example/
>>             a/
>>               ExampleA.java
>>       com.example.module_b/
>>         module-info.java
>>         com/
>>           example/
>>             b/
>>               ExampleB.java
>> 
>> However, even though my Gradle-based project builds fine, NetBeans 
>> highlights my package delclarations claiming that the package name is wrong. 
>>  It appears to be confused about the root folder for the module.  It thinks 
>> the module name should be repeated in the package name, or the .java files 
>> should be moved to a folder without the module name folder as the root.
>> 
>> E.g. based on the above layout, ExampleA.java has:
>> 
>> package com.example.a;
>> 
>> but NB wants it to be:
>> 
>> package com.example.module_a.com.example.a;
>> 
>> or relocated to:
>> 
>> src/main/java/com/example/a/ExampleA.java
>> 
>> without the module name subfolder.
>> 
>> Does NetBeans support modules when there is more than one in the project?  I 
>> can make it stop complaining if I only have one module and I remove the 
>> module name folder so the module root is not in a subfolder of src/main/java/
>> 
>> I couldn’t find anything in Jira related to this.  Is it not supported yet, 
>> or am I doing something wrong?
>> 
>> Regards,
>> 
>> Scott
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: dev-h...@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to