【问题标题】:Installed Eclipse 2020-06, but didn't get Maven Project under File->New Section安装了 Eclipse 2020-06,但在 File->New Section 下没有得到 Maven Project
【发布时间】:2020-07-21 16:57:18
【问题描述】:

我已经安装了 Ecipe 2020-06,但在 File->New 下找不到 Maven Project 选项。所以我尝试从 File->New->Project 创建一个 Maven 项目。

然后我收到 2 个警告:

  1. 构建路径指定执行环境 J2SE-1.5。工作区中没有安装 JRE 与此环境严格兼容的。new-project 构建路径 JRE 系统 图书馆问题

  2. 指定的编译器合规性是 1.5,但使用的是 JRE 1.8 new-project Compiler 合规性 JRE 编译器合规性问题

pom.xml 的内容作为图像附加。它不包含它应该包含的构建或属性或依赖项块。

我在 Windows 7 中有 JDK 1.8 和 JRE 1.8。

如何解决问题?我应该安装一些其他版本的 Eclipse 吗?

【问题讨论】:

  • 为干净的解决方案添加 maven 编译器插件。
  • @emotionlessbananas 不需要,因为它已经绑定在生命周期内......请参阅 J Fabian Meier 的答案,这是正确的方法。
  • @khmarbaise 不确定是否在属性中添加版本,但添加插件也可以解决嵌套子模块的问题,如果有的话

标签: java eclipse maven


【解决方案1】:

您的 Eclipse 没有任何问题。

你只需要添加

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

致您的pom.xml

另见:

https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

【讨论】:

  • 那么您是否使用 ALT+F5 更新了您的项目或重新启动了您的 Eclipse?
猜你喜欢
  • 1970-01-01
  • 2020-10-07
  • 1970-01-01
  • 1970-01-01
  • 2014-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多