This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 179009 - Cannot find symbol in Maven projects after SVN commit
Summary: Cannot find symbol in Maven projects after SVN commit
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.2
Hardware: PC Windows XP
: P3 normal with 4 votes (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-23 13:15 UTC by sweetlandj
Modified: 2013-10-23 07:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test Projects Used To Replicate the Issue (8.90 KB, application/octet-stream)
2012-08-09 20:19 UTC, kldavis4
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sweetlandj 2009-12-23 13:15:05 UTC
I have a Maven parent POM with a number of sub-projects with artifact types EJB, EAR, or WAR.  One of the EJB modules contains a persistence unit.  Occarsionally, when I have committed changes to the EJB module (SVN) I begin to see "Cannot find symbol" errors in the dependent projects.  I can work around this temporarily by shutting down NetBeans, deleting .netbeans/6.8/var/cache, and then restarting NetBeans.  I believe it has something to do with the combination of Maven, SVN, and IDE caching.  I have only seen this happen with commits to the persistence unit EJB module, but that's the only one I've worked in since upgrading to 6.8.  I did not experience this issue in 6.7.1 or prior.
Comment 1 Max Sauer 2010-01-04 03:10:19 UTC
Could you please send us a sample project or at least a precisely describe the project setup? Thanks.
Comment 2 cosmocracy 2010-05-19 13:50:33 UTC
I am also having this issue under Windows XP.  Here are the version specifics:

  Product Version: NetBeans IDE 6.8 (Build 200912041610)
  Java: 1.6.0_05; Java HotSpot(TM) Client VM 10.0-b19
  System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
  Userdir: C:\Documents and Settings\esk001\.netbeans\6.8

I am also using both Maven and Subversion.  When I exit NetBeans, delete the cache directory (as suggested by sweetlandj), restart and wait for the LENGTHY "Scanning projects..." to complete, it works again.  

(As if we need more discouragement to commit to source control *smile*)

The projects that I'm using were both generated from Maven Archetypes (via NetBeans).  If you can point me to instructions for exporting what you need, I'd be happy to share the projects although my hunch is that you'd need the SVN interactions as well to reproduce.
Comment 3 Vitezslav Stejskal 2010-05-19 14:54:50 UTC
Could you please try 6.9beta and check if the situation improved? Thanks
Comment 4 sweetlandj 2010-05-20 13:50:50 UTC
I'm now running 6.8 (Build 200912041610) and I haven't had this problem in quite some time
Comment 5 Vitezslav Stejskal 2010-05-21 06:57:49 UTC
I see. Well, then I suppose we can close this as WORKSFORME. If it happens again please reopen and try to attach as much info as possible - eg. IDE log file, the project (if possible), nb-userdir including caches, ... Ideally we would like to have a reproducible testcase, but I understand that it may not be possible to find one.
Comment 6 smil 2012-07-26 13:52:55 UTC
Hi,

This is indeed a bug which is very annoying. I had this problem with my previous two projects, both contained >100 maven projects. Mostly happens after we change the pom versions. 

It is not related to SVN commits, it is something related to the order of the files scanned.

The project compiles using command line and using 'Build' menu.

Other references from the "wild":

http://stackoverflow.com/questions/10176600/are-maven-project-better-to-work-with-in-netbeans-than-eclipse
 -- Maybe you could ask his project, because it was only some "demo".


http://stackoverflow.com/questions/8961164/cannot-find-symbol-errors-in-netbeans

I was able to reproduce it without a problem in 7.2! So I think this issue indeed fresh!

Info:
I'm using free-form-project-group and opened mostly all of the maven project.

After creating a "project and required"-group during the background scan the errors counted up again. Change back to the old project group reduced the error count.

Opening up the files with errors / editing them triggers a rescan. Sometimes resolves many errors.

Eg. Class A uses Class B. A complains about missing method from B, click on the missing method triggers, NB jump to the right locations, triggers a background scan and the error disappears.

Please tell me what you need to investigate this issue. I'll try to reproduce it for you using an open-source project.
Comment 7 kldavis4 2012-08-09 20:19:53 UTC
Created attachment 122956 [details]
Test Projects Used To Replicate the Issue

The zip file contains a set of three maven projects that can be used to replicate this issue. There are two versions of the same "Lib" artifact, LibA & LibB. They differ only in the method signature of com.company.Foo.bar(). There is an App project which depends on the Lib project and calls the Foo.bar method.

To replicate, install LibA from the command line. Open App & LibA in Netbeans. Build App in netbeans. Install LibB from the command line. Close LibA project and open LibB project. Rebuild App, and you should expect to see a compile error in the console because the method signature has changed. The editor, though, doesn't show a compile error. If you change the string in class Foo in App project to an int, the editor shows a method cannot be applied to given types error. Close and reopen Netbeans and the error goes away.
Comment 8 dloiacono 2012-10-16 07:22:01 UTC
Same problem with 7.1.1 version and > 100 maven projects.
Netbeans says many "Cannot find symbol" errors.
To workaround this problem I have to shutting down NetBeans, deleting .netbeans/6.8/var/cache and restart it or modify unrecognized source classes.
It's a very annoying problem.
Comment 9 Svata Dedic 2013-10-23 07:17:54 UTC
The test scenario given in Comment #7 works fine in dev version (error is shown even in the editor).

Setting to WORKSFORME; before reopening, please upgrade to at least 7.4 final to verify the defect is still present.