Bug 218658 - Generated Sources for JPA metamodel are not recognized in source packages
Generated Sources for JPA metamodel are not recognized in source packages
Product: java
Classification: Unclassified
Component: Compiler
All All
: P2 with 15 votes (vote)
: 8.1
Assigned To: Dusan Balek
: 251130 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2012-09-20 07:27 UTC by marcincinik
Modified: 2015-09-11 10:59 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT

compilation issues (100.96 KB, image/png)
2012-09-20 07:27 UTC, marcincinik

Note You need to log in before you can comment on or make changes to this bug.
Description marcincinik 2012-09-20 07:27:41 UTC
Created attachment 124617 [details]
compilation issues

Please consult the screenshot first.

I am using JPA generated metamodel which in turn uses metamodel processor from eclipse link (this is standard mechanism used in java based on META-INF/"services").

Metamodel is generated properly during compilation phase and the generated classes show up in "Generated Sources (annotations)" (also properly).

The problem:
Classed belonging to "Source packages" (normal classes) in general can't see any classes which show up in "Generated sources (annotations)".

The project build is based on maven. Maven build succeeds, however Netbeans shows some imports which cannot be resolved which leads to compilation failures reported by Netbeans. Those imports are coming from the "Generated sources (annotations)".

The problem persists also in dev 201209200001
Comment 1 cheesus 2013-10-13 19:56:56 UTC
experiencing the same problem on 7.4RC1s (same project, several people on different OSses).

strange enough, adding build/generated-sources/ap-source-output to src path and removing it again after one good compile did indeed helped...!?
Comment 2 cheesus 2013-10-14 09:26:16 UTC
The safer way seems to be:

stop netbeans
rm -rf  ${HOME}/.cache/netbeans/7.4rc1/
(or Library/Caches/NetBeans/7.4rc1)
start netbeans
clean build
Comment 3 pierrecaron 2013-10-24 17:23:43 UTC
I also have the same problem.

I cannot find the ${HOME}/.cache/netbeans/7.4rc1/ (or library/Caches/NetBeans/7.4rc1) folder (I'm running on Windows XP).
Comment 4 luca.adamo 2014-01-30 17:56:31 UTC
It is still happening to me, both on version 7.2.1 and version 7.4. The same exact project compiles fine on another workstations with 7.4. I tried to delete the cache and restart with no luck. The only workaround is to manually add the build/generated-sources folder to the src PATH
Comment 5 chriswesdorp 2014-06-06 11:22:45 UTC
Running into the same issue working with Product Version: NetBeans IDE 8.0 (Build 201403101706)

Clearing the cache seems to remove the problem for the first start, but the problem returns after changes to the entities.
Comment 6 ender01 2014-08-25 20:04:59 UTC
I am seeing the same behavior with generated classes from the cxf-codegen-plugin. 
Maven still builds/compiles everything fine but the editor complains about the classes not being found.
Comment 7 fistons 2014-12-30 12:39:18 UTC
Same problem here, with Netbeans 8.0.2. Cleaning the cache seems to work with Linux but not with Windows 7
Comment 8 FiruzzZ 2015-02-23 12:23:21 UTC
Bug remains on
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
I tried changing the lib, switching between eclipselink 241 > 252, didn't work, now the IDE doesn't find more generated meta model than before
Comment 9 FiruzzZ 2015-02-23 12:36:46 UTC
(In reply to FiruzzZ from comment #8)
> Bug remains on
> Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
> I tried changing the lib, switching between eclipselink 241 > 252, didn't
> work, now the IDE doesn't find more generated meta model than before

PD: removing the cache folder /local/netbeans/cache solved the issue, but the IDE threw a few problems notifications on its start up
Comment 10 naskaom 2015-03-03 14:33:03 UTC
Clearing the .cache/netbeans/8.0.2 didn't work for me. I had to add generated metamodel classes to the src path and not remove them. Confused.
Comment 11 RayDeCampo 2015-03-03 14:41:06 UTC
I was experiencing this issue on a Maven project where the JPA implementation was Hibernate.  I solved it by adding hibernate-entitymanager and hibernate-jpa-2.1-api to the pom.xml as provided dependencies.  HTH
Comment 12 naskaom 2015-03-03 18:58:02 UTC
Mine is not a maven project. And I use eclipselink.
Comment 13 Petr Hejl 2015-04-16 07:46:42 UTC
*** Bug 251130 has been marked as a duplicate of this bug. ***
Comment 14 koarl 2015-08-11 08:16:02 UTC
Same here (NB 8.0.2, Maven, JPA metamodel generated by Hibernate). Clearing the cache works (at least on Linux), but this is not an option when working with large projects on a daily basis. 

I'm using NB for over a decade now (each and every workday), but this one is driving me crazy. Please fix it.
Comment 15 Dusan Balek 2015-09-08 13:11:45 UTC
Unfortunately, I cannot reproduce the problem in the current dev build. I have tried to create a simple Maven project with eclipselink and it seems to work as expected. Could you please create a simple test project demonstrating the problem and attach it to the issue? Also, cloud you please check that your source root's cache directory contains sources generated by the eclipselink's annotation processors? (go to var/cache/index directory located in your NB userdir, in Segments file find which segment belongs to your source root and go to the proper segment directory. There should be directory java/14/sources containing all sources generated by the annotation processors). Thanks.
Comment 16 FiruzzZ 2015-09-11 10:59:08 UTC
(In reply to Dusan Balek from comment #15)

java/14 has
  /classes/projectname/test (with a few random testing classes)
      (3 segments, .gen, .cfs)
  /sources (empty)
  /whitelist (empty)

Nothing related to "generated model" or any classes

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo