What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?

前端 未结 13 2145
情深已故
情深已故 2020-11-27 09:51

I imported a Maven project and it used Java 1.5 even though I have 1.6 configured as my Eclipse default Preferences->Java->Installed JREs.

When I

13条回答
  •  失恋的感觉
    2020-11-27 10:14

    Project specific settings

    One more place where this can go wrong is in the project specific settings, in Eclipse.

    1. project properties: click your project and one of the following:

      • Alt + Enter
      • Menu > Project > Properties
      • right click your project > project properties (last item in the menu)
    2. click on "Java Compiler"

    3. Uncheck "Enable project specific settings" (or change them all by hand).

    Because of client requirements we had them enabled to keep our projects in 1.6. When it was needed to upgrade to 1.7, we had a hard time because we needed to change the java version all over the place:

    • project POM
    • Eclipse Workspace default
    • project specific settings
    • executing virtual machine (1.6 was used for everything)

提交回复
热议问题