Eclipse + Maven: force Execution Environment “JavaSE-1.6” instead of fixed JDK

后端 未结 3 910
刺人心
刺人心 2021-01-02 11:19

I\'m using Eclipse as IDE and Maven outside of it to keep all dependencies up to date and update the Eclipse-project as such. In Eclipse I usually specify the JRE system lib

相关标签:
3条回答
  • 2021-01-02 12:12

    Go into Window > Preferences > Java > Installed JREs > Execution Environments

    Select JavaSE-1.6, click the checkbox on the right that should indicate "perfect match"

    then use "update project configuration" from the maven menu.

    0 讨论(0)
  • 2021-01-02 12:14

    You can do it by setting a classpath container.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.8</version>
        <configuration>
            <classpathContainers>
               <classpathContainer>
        org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6
               </classpathContainer>
            </classpathContainers>
        </configuration>
    </plugin>
    

    Reference:

    • eclipse:eclipse Mojo > classpathContainers
    0 讨论(0)
  • 2021-01-02 12:25

    Since you are using maven and eclipse, perhaps you should use M2Eclipse plugin. The maven project (built by maven by setting JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23) imported in Eclipse, shows up with JRE System Library as JavaSE-1.6

    0 讨论(0)
提交回复
热议问题