简体   繁体   English

Eclipse:Java Build Path重置中的JRE系统库

[英]Eclipse: JRE System Library in Java Build Path reset

For developing a JavaFX application I'm using a 4.3.1 snapshot of eclipse together with JDK 8 build b116. 为了开发JavaFX应用程序,我使用了eclipse4.3.1快照和JDK 8 build b116。 In my workspace projects the JRE library inclusion in the build path get resetted back to Java 1.4 all the time: 在我的工作区项目中,构建路径中的JRE库包含始终重置为Java 1.4:

问题

Unfortunately, this can only be fixed temporary (until the next eclipse restart): 不幸的是,这只能暂时修复(直到下一次eclipse重启):

临时解决方案

In the build section of my pom files I have: 在我的pom文件的构建部分,我有:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <debug>true</debug>
        <debuglevel>source,lines</debuglevel>
    </configuration>
</plugin>

I'd appreciate a less volatile solution. 我很欣赏一个不太灵活的解决方案。

[UPDATE] The issue seems to be fixed with the current versions of [更新]这个问题似乎与当前版本的问题有关

  • Java 8 (1.8.0-ea-b121), Java 8(1.8.0-ea-b121),
  • Maven (3.1.1/1.5.0.20131218-0705), Maven(3.1.1 / 1.5.0.20131218-0705),
  • m2e (1.5.0.20131218-1208) together with the m2e(1.5.0.20131218-1208)连同
  • JDT beta patch [ Update site ]. JDT beta补丁[ 更新站点 ]。

The maven eclipse plugin (m2e) selects a java execution environment depending on the <source> and <target> properties for the maven compiler plugin. maven eclipse插件(m2e)根据maven编译器插件的<source><target>属性选择java执行环境。

The problem is that there is neither a 1.8 execution environment available in Kepler nor the m2e maven compiler connector can map it yet. 问题是Kepler中既没有1.8执行环境,也没有m2e maven编译器连接器可以映射它。

Thus I see two solutions until it is supported in Kepler and m2e: 因此,我看到两个解决方案,直到它在Kepler和m2e中得到支持:

  1. Let maven change the environment to 1.4 and map your 1.8 JDK to the execution environment J2SE-1.4. 让maven将环境更改为1.4并将1.8 JDK映射到执行环境J2SE-1.4。 Then your project will use the correct JDK. 然后您的项目将使用正确的JDK。 But then all projects that depend on 1.4 will use the 1.8 JDK of course. 但是依赖1.4的所有项目当然都会使用1.8 JDK。

  2. Use the pluginManagenent to turn off the maven-compiler-plugin lifecycle handling. 使用pluginManagenent关闭maven-compiler-plugin生命周期处理。 This should prevent the m2e plugin from updating the execution environment and you can set it manually. 这应该可以防止m2e插件更新执行环境,您可以手动设置它。

     <pluginManagement> <plugins> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <versionRange>[1.0.0,)</versionRange> <goals> <goal>compile</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM