I\'m having something quite peculiar here, my build is successful in maven when I type \"mvn clean install\" however once imported into Eclipse it\'s showing errors.
The other upvoted answers did not work for me using these versions:
This is what I had to do:
.classpath
, .project
, and .settings
directoryTry to use different/older version of JRE. In my case switching back to JRE7 from JRE8 eliminated the problem.
Delete and Re-Import the project in eclipse (without deleting files of course). Unlike other answers I have not looked into why this happens but it works. poof - compilations errors be-gone
I found that my project was using a project specific Java Compiler setting set to Java 1.5. Furthermore, the project facets were still referencing Java 1.5 when Maven, m2e, Eclipse general Java Compiler settings were all set to Java 1.8.
Go to Eclipse> Project (Menu) > Clean... > Select project to clean
This also removes invalid errors from Eclipse.
Sometimes I get these types of issues as well.
Generally, what worked best for me with Eclipse & Maven: