从 1.6 移动到 1.7(基于 maven 的项目)后,无法在 Jetbrains Intellij 中使用 Java 1.7 进行编译 [英] Unable to compile using Java 1.7 in Jetbrains Intellij after moving from 1.6 to 1.7 (maven based project)

查看:35
本文介绍了从 1.6 移动到 1.7(基于 maven 的项目)后,无法在 Jetbrains Intellij 中使用 Java 1.7 进行编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用基于 Maven 项目的 Jetbrains 11.2 项目.然后我需要移动到 1.7.我安装了 1.7,我更新了 pom.xml,我可以使用 maven 重建整个包.

Using Jetbrains 11.2 project based on a Maven project. Then I required to move to 1.7. I have 1.7 installed , I updated my pom.xml and I can rebuild the whole package using maven okay.

我已经修改了我在 Intelli Projects 设置中可以看到的关于 Java 版本的所有设置

I've modified every setting I can see in Intelli Projects settings regarding Java version

  • 项目 SDk
  • 项目语言级别
  • 模块语言/来源/语言级别
  • 模块语言/依赖项/模块 SDK

但我无法编译它抱怨的文件:

but I cannot get it to compile a file it complains:

Error:javac target release of 1.6 conflicts with source release 1.7

然后我在我的另一台开发机器上尝试使用相同的代码库但不同的 Intellij 项目,在此我得到了类似的错误:

I then tried on my other dev machine using the same codebase but a different Intellij Project and on this I get a similar error:

Error:javac: source release 1.7 requires target release 1.7

我看不出还有什么可以改变以使其正常工作.

I cannot see anything else to change in order to get this working.

推荐答案

Doh,找到了

文件/设置/Java 编译器/附加命令行参数

File/Settings/Java Compiler/Additional command line parameters

-target 1.6 更改为 -target 1.7

不过,它出现在这里似乎很奇怪,与其他相关选项断开连接.

Does seem wierd for it to be here though, disconnected from the rest of the related options.

这篇关于从 1.6 移动到 1.7(基于 maven 的项目)后,无法在 Jetbrains Intellij 中使用 Java 1.7 进行编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆