You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "Saljack (via GitHub)" <gi...@apache.org> on 2025/02/20 07:47:55 UTC

[I] Maven generated sources are not loaded [netbeans]

Saljack opened a new issue, #8262:
URL: https://github.com/apache/netbeans/issues/8262

   ### Apache NetBeans version
   
   Apache NetBeans 24
   
   ### What happened
   
   I still have some issues with generated sources from annotation processors or openapi-generator-maven-plugin. I am pretty sure that everything is configured correctly and sometimes it works. But sometimes it is completely broken and I am not able to fix it. Generated source folders are correctly visible in projects but if I try to open them but there are empty.
   
   ![Image](https://github.com/user-attachments/assets/e5ed4558-5b31-4f65-bbae-f66e5822786a)
   
   I checked netbeans log and I see that there were indexed:
   ```
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\.openapi-generator
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\.openapi-generator took: 73 ms (New or modified files: 4, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\openapi
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\openapi took: 285 ms (New or modified files: 42, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\.github
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\.github took: 61 ms (New or modified files: 1, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\docs
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\docs took: 84 ms (New or modified files: 11, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\api
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\api took: 84 ms (New or modified files: 1, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\annotations
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\annotations took: 80 ms (New or modified files: 1, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\src
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\src took: 106 ms (New or modified files: 4, Deleted files: 0) [Adding listeners took: 0 ms]
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\src\main\java took: 1,351 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\src\test\java took: 60 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\gradle
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\gradle took: 60 ms (New or modified files: 2, Deleted files: 0) [Adding listeners took: 0 ms]
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 30 source roots took: 2,970 ms (New or modified files: 66, Deleted files: 0) [Adding listeners took: 0 ms]
   ```
   
   For example `target\generated-sources\openapi`
   ```
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\openapi
   INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\openapi took: 285 ms (New or modified files: 42, Deleted files: 0) [Adding listeners took: 0 ms]
   ```
   So it scanned correctly 42 new files but it is not loaded and editor does not see these classes:
   
   ![Image](https://github.com/user-attachments/assets/ec5f8c6f-41bb-43ea-9d6b-1015d551f327)
   but the class is there:
   ![Image](https://github.com/user-attachments/assets/5d3f2c6b-fca5-43f4-a998-ce65b8faae67)
   
   Sometimes it helps to delete their target folder and then delete Netbeans cache or build a project from the command line. But I have some other projects that cannot be fixed anymore but they worked fine in the past and nothing regarding generating sources was not changed. 
   
   See the correctly loaded generated sources:
   ![Image](https://github.com/user-attachments/assets/00f7da14-ceea-480b-bcc1-62dac34d88bc)
   
   Here is a testing project with Lombok, Mapstruct and openapi-generator-maven-plugin:
   
   [GenerateSources.zip](https://github.com/user-attachments/files/18882757/GenerateSources.zip)
   
   ### Language / Project Type / NetBeans Component
   
   Java Maven Project
   
   ### How to reproduce
   
   I do not know how to reproduce it because the same project worked ok one day ago and stopped working without any change only by rebuilding.
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows 11
   
   ### JDK
   
   Adoptioum 21
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   I would like to enable some debug logging but I do not have any idea what to enable and what to monitor.
   
   ### Are you willing to submit a pull request?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


Re: [I] Maven generated sources are not loaded [netbeans]

Posted by "Saljack (via GitHub)" <gi...@apache.org>.
Saljack commented on issue #8262:
URL: https://github.com/apache/netbeans/issues/8262#issuecomment-2676077988

   I tried to run Netbeans with an empty userdir and the problem is still there so it is not connected to my configuration. I checked logs with working and without working generated sources and found if there is this line in my log:
   ```
   WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: C:\Users\tpoledny\Documents\NetBeansProjects\GenerateSources\target\generated-sources\openapi
   ```
   then it does not work and if this line is missing then it works.  So I would say the problem is here in this condition (no `compilePath` or `sourcePath`?):
   https://github.com/apache/netbeans/blob/64c10fb23d396ea8793a5efb53700947b0ab7393/java/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java#L248
   
   But how is it possible that sometimes it works and sometimes it is totally broken? 
   
   This is also interesting it looks like it worked in some moment but it was removed from this view.
   ![Image](https://github.com/user-attachments/assets/62ccd775-d246-4e5f-a27f-788b83b2dd37)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


Re: [I] Maven generated sources are not loaded [netbeans]

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing closed issue #8262: Maven generated sources are not loaded
URL: https://github.com/apache/netbeans/issues/8262


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


Re: [I] Maven generated sources are not loaded [netbeans]

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8262:
URL: https://github.com/apache/netbeans/issues/8262#issuecomment-2676086174

   The openapi generator does not generate bindings, it generates a complete project structure. Modify the `output` elements in your configurations to point to different directories and check the output. The two generations overlay each other and thus you'll get unpredictable behavior. What is more NetBeans assumes, that the source roots are directly in generated-sources not somewhere, more deeply nested.
   
   I think I tested the generator for the "maven integration" usecase and had a solution for this, I'll check my notes on monday.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


Re: [I] Maven generated sources are not loaded [netbeans]

Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
matthiasblaesing commented on issue #8262:
URL: https://github.com/apache/netbeans/issues/8262#issuecomment-2676347496

   I simplified this and (I think) fixed it:
   
   ```diff
   --- a/src/main/java/com/example/generatesources/GenerateSources.java
   +++ b/src/main/java/com/example/generatesources/GenerateSources.java
   @@ -1,17 +1,11 @@
    package com.example.generatesources;
    
   -import com.example.client.domain.PetDTO;
   -import com.example.openapi.client.api.PetApi;
   +import org.openapitools.model.PetDTO;
    
    public class GenerateSources {
    
        public static void main(String[] args) {
   -        MapstructMapper mapper = new MapstructMapperImpl();
   -        mapper.map(new Bar());
   +    new PetDTO();
            System.out.println("Hello World!");
   -        PetApi petApi = new PetApi();
   -        PetDTO petDTO = new PetDTO();
   -        petDTO.setName("Test");
   -        petApi.addPet(petDTO);
        }
    }
   
   ```
   
   - use correct package for DTO files (package of imported class, did not match the target package for generator)
   - added my understanding of an expected call for Mapstruct
   - added call to generated api
   
   
   ```diff
   --- a/pom.xml
   +++ b/pom.xml
   @@ -76,29 +76,7 @@
              </configOptions>
            </configuration>-->
            <executions>
   -          <execution>
   -            <id>openapi-server</id>
   -            <goals>
   -              <goal>generate</goal>
   -            </goals>
   -            <configuration>
   -              <generatorName>spring</generatorName>
   -              <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
   -              <generateSupportingFiles>true</generateSupportingFiles>
   -              <generateApiDocumentation>true</generateApiDocumentation>
   -              <generateModels>true</generateModels>
   -              <generateModelTests>false</generateModelTests>
   -              <generateApiTests>false</generateApiTests>
   -              <modelNameSuffix>DTO</modelNameSuffix>
   -              <output>${project.build.directory}/generated-sources</output>
    
   -              <configOptions>
   -                <sourceFolder>openapi</sourceFolder>
   -                <useJakartaEe>true</useJakartaEe>
   -              </configOptions>
   -            </configuration>
   -          </execution>
   -
              <execution>
                <id>openapi-client</id>
                <goals>
   @@ -111,15 +89,17 @@
                  <library>restclient</library>
                  <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
                  <generateSupportingFiles>true</generateSupportingFiles>
   -              <generateApiDocumentation>true</generateApiDocumentation>
   +              <generateApiDocumentation>false</generateApiDocumentation>
                  <generateModels>true</generateModels>
                  <generateModelTests>false</generateModelTests>
                  <generateApiTests>false</generateApiTests>
   +              <generateModelDocumentation>false</generateModelDocumentation>
                  <modelNameSuffix>DTO</modelNameSuffix>
   -              <output>${project.build.directory}/generated-sources</output>
   +              <output>${project.build.directory}/generated-sources/democlient</output>
   +              <supportingFilesToGenerate>ApiClient.java,Authentication.java,HttpBasicAuth.java,HttpBearerAuth.java,ApiKeyAuth.java,OAuth.java,JavaTimeFormatter.java,RFC3339DateFormat.java</supportingFilesToGenerate>
    
                  <configOptions>
   -                <sourceFolder>openapi</sourceFolder>
   \ No newline at end of file
   +                <sourceFolder>./</sourceFolder>
   \ No newline at end of file
                    <useJakartaEe>true</useJakartaEe>
                  </configOptions>
                </configuration>
   
   ```
   
   - Reduce openapi generated code to only server (I fail to see why you would need both parts in the same project).
   - Disable api documentation generation (this only messes up the output directory)
   - Disable model documentation generation (this only messes up the output directory)
   - Move output of the generation to the right base directory (`<project.build.directory>/generated-sources/<per-client-name>`)
   - Ensure sources are put into the root of the output folder
   
   
   Note: For NB25 and lombok read https://github.com/apache/netbeans/discussions/8221
   
   Unless more arguments are made, I don't see an issue and will move this to discussion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


Re: [I] Maven generated sources are not loaded [netbeans]

Posted by "Saljack (via GitHub)" <gi...@apache.org>.
Saljack commented on issue #8262:
URL: https://github.com/apache/netbeans/issues/8262#issuecomment-2676131396

   I am pretty sure that it is configured correctly and it works sometimes as you can see on one of picture that it is correctly visible. I know that openapi-generator-maven-plugin generates weird structure but it is configured that sources are in `target/generated-sources/openapi/com/example`. I would agree it is problem with openapi-generator-maven-plugin but other annotation procesors do not work too e.g. mapstruct see `target/generated-sources/annotations`. So if it is the openapi-generator-maven-plugin then it breaks the whole support for annotation processors. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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