3

From time to time, Eclipse (Indigo) complains that certain classes in my projects cannot be resolved to a type. Even it shows the class in popup list, clicking import (see image) does not add the import statement! Even if I add it manually, it doesn't recognize it (and underlines the import package).

  • This happens only in certain projects.
  • Unresolved types are in the same project! (not in other dependencies)
  • cleaning the project does resolve this, but only temporarily.
  • My application consists of multi-module maven based projects.
  • All projects are maven-based.

Not recognizing imports

Rafael
  • 7,002
  • 5
  • 43
  • 52
MoneerOmar
  • 205
  • 2
  • 4
  • 18

4 Answers4

9

Right click on your project name ->Maven ->Update Project

0

For those not using Maven, simply deleting the project (and possibly re-cloning it) has reliably worked for me.

CertainPerformance
  • 356,069
  • 52
  • 309
  • 320
user7396627
  • 105
  • 2
  • 8
0

This just happened to be in Eclipse Neon.2 (2016 release) on a non-Maven project. Refreshing / updating the project did not help, but I was able to fix this without recreating the project:

  1. Go to Properties → Build Path → Source
  2. Remove all source folders in the build path, click Apply.
  3. Add them all back, click Apply.
Stu Blair
  • 1,323
  • 15
  • 24
  • interestingly in my gradle project set up removing and adding them causes the issues to flicker on screen like it sees them then they vanish from sight again. very frustrating but did not help me – Dexter Whelan Mar 14 '20 at 19:53
0

Right click on the project -> Maven -> Update Project...

Check (Force Update of Snapshots/Releases)

AGŞ
  • 1
  • 1