Successful build in Maven still showing errors in Eclipse

前端 未结 18 1729
猫巷女王i
猫巷女王i 2020-12-24 07:04

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.

相关标签:
18条回答
  • 2020-12-24 07:31

    The other upvoted answers did not work for me using these versions:

    • Eclipse Neon
    • Maven 3
    • m2e 1.7

    This is what I had to do:

    1. Delete the Eclipse project from Eclipse interface (do not delete project contents on disk)
    2. Go to the project's root directory in a file explorer or terminal
    3. Delete these files: .classpath, .project, and .settings directory
    4. Back to Eclipse, File -> Import... -> Maven -> Existing Maven projects
    0 讨论(0)
  • 2020-12-24 07:34

    Try to use different/older version of JRE. In my case switching back to JRE7 from JRE8 eliminated the problem.

    0 讨论(0)
  • 2020-12-24 07:34

    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

    0 讨论(0)
  • 2020-12-24 07:35

    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.

    0 讨论(0)
  • 2020-12-24 07:36

    Go to Eclipse> Project (Menu) > Clean... > Select project to clean

    This also removes invalid errors from Eclipse.

    0 讨论(0)
  • 2020-12-24 07:38

    Sometimes I get these types of issues as well.

    Generally, what worked best for me with Eclipse & Maven:

    • Use the latest m2e Eclipse plugin
    • Use Maven 3
    • Make sure m2e uses the same Maven version as the one you're using on the command line (not the internal one)
    • Import projects as Maven projects to generate the Eclipse project files
    0 讨论(0)
提交回复
热议问题