I have a Java project that I’m working on in Eclipse Indigo. Seemingly randomly (but usually after a file save) the IDE will stop recognizing my classes for which the only solution is a project clean. For example, I have a class FailedJobManager.java in the package com.ccn.sec which references a DistributionJob.java in the package com.ccn.sec.domain. When the problem manifests I will get an error in the FailedJobManager saying: DistributionJob cannot be resolved to a type. The import of DistributionJob also errors saying that the import cannot be resolved. If I do a clean the errors disappear.
I don’t mind clicking clean once in a while but when I have to click it every 2 minutes it gets old real quick. I have tried playing with the build path order but to no avail.
Has anyone else experienced this before and if so what did you do to fix it?
I found the problem. I have an ANT build that was outputting the compiled classes to the same build folder that the Eclipse build outputs its compiled classes. After doing an ANT build of the project the ANT compiled classes would get put into the build/WEB-INF/classes. Subsequently modifying a file and then saving that file would trigger an Eclipse build that would put the Eclipse compiled classes in build/classes resulting in the build folder containing two sets of the same classes. This apparently created a conflict for the Eclipse compiler giving me the “… cannot be resolved to a type” errors. Moving the ANT build folder to a dedicated folder resolved the problem.