Why doesn't NetBeans IDE see the generated sources?

AlanObject picture AlanObject · Mar 23, 2012 · Viewed 9.4k times · Source

I have a Maven-built web-app that uses JPA 2.0 at the back end. The JPA provider is EclipseLink 2.3.2.

When I build the project (and it deploys runs successfully) it builds the JPA meta-model in the directory

${basedir}/target/generated-sources/annotations/

Yet the IDE doesn't see the classes defined there. Little red dots with an exclamation point everywhere. Yet I can navigate to those files in the Projects window and open the generated source files.

Does this happen to anyone else and does anyone know of a way to fix it?

UPDATE:

As a work-around I have discovered that I can exit NetBeans, delete the NetBeans cache directory, then restart. This forces NetBeans to rebuild the cache and then the classes become visible again. Should I submit a bug to the NetBeans bug tracker? I can't come up with a test case to make it happen, but it does fairly often.

Answer

jeqo picture jeqo · Jul 15, 2016

If you go to project properties/sources there is a note about this: you need to generate sources under

${basedir}/target/generated-sources/FOOBAR 

where FOOBAR is the name of your plugin.

enter image description here