如何在 Eclipse Luna 中更新 Maven 配置?
How do I update the Maven configuration in Eclipse Luna?
我在 Eclipse Luna 中为我的 JRE 使用 Java 8 和 m2e Maven 插件。我一创建 Maven 项目就看到了这个警告:Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
我在这个网站上看到很多关于如何处理这个错误的旧建议,但与 Java 8 无关。我还认为 Oracle says J2SE was deprecated in 2008。到目前为止,我发现的最有希望的答案来自@Pascal Thivent:
Warning - Build path specifies execution environment J2SE-1.4
但这些说明似乎不再与 Luna 相关:
Eclipse project Properties > Maven > Update Project Configuration
我在 Maven 下只看到 "Lifecycle mapping"。
有人可以解释一下 (1) 这个错误是什么意思 (2) 鉴于 J2SE-1.5 似乎已被弃用,如果它仍然令人担忧 (3) 如何在 Luna 中最好地修复它?
- 此错误是因为项目 pom 文件指示 maven 针对 java 1.5.
进行编译
- 最好编译和测试当前的 java 版本。在你的情况下 java 8.
我不确定如何在 eclipse 中修复它 IDE,但是可以编辑项目 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>
</configuration>
</plugin>
我在 Eclipse Luna 中为我的 JRE 使用 Java 8 和 m2e Maven 插件。我一创建 Maven 项目就看到了这个警告:Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
我在这个网站上看到很多关于如何处理这个错误的旧建议,但与 Java 8 无关。我还认为 Oracle says J2SE was deprecated in 2008。到目前为止,我发现的最有希望的答案来自@Pascal Thivent:
Warning - Build path specifies execution environment J2SE-1.4
但这些说明似乎不再与 Luna 相关:
Eclipse project Properties > Maven > Update Project Configuration
我在 Maven 下只看到 "Lifecycle mapping"。
有人可以解释一下 (1) 这个错误是什么意思 (2) 鉴于 J2SE-1.5 似乎已被弃用,如果它仍然令人担忧 (3) 如何在 Luna 中最好地修复它?
- 此错误是因为项目 pom 文件指示 maven 针对 java 1.5. 进行编译
- 最好编译和测试当前的 java 版本。在你的情况下 java 8.
我不确定如何在 eclipse 中修复它 IDE,但是可以编辑项目 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> </configuration> </plugin>