出现Error:java: javacTask: source release 1.7 requires target release 1.7

红太狼 2022-08-17 15:26 255阅读 0赞

使用IDEA编译Java代码的过程中出现下面这样一个错误:

Error:java: javacTask: source release 1.7 requires target release 1.7

上图:

Center

出现这样的问题后,可以在Settings中设置:

Center 1

在这里将编译器的版本设置为1.7就ok了。1处是设置project的, 2处设置module的。

如果使用maven构建的话,直接在pom中指定Java的编译版本吧,加入如下的code:

  1. <build>
  2. <finalName>5_mybatis_maven</finalName>
  3. <plugins>
  4. <plugin>
  5. <artifactId>maven-compiler-plugin</artifactId>
  6. <configuration>
  7. <source>1.7</source>
  8. <target>1.7</target>
  9. </configuration>
  10. </plugin>
  11. </plugins>
  12. </build>

然后选中pom.xml点击右键,Reimport让maven将相应的插件给下载下来:

Center 2

现在去编译,是不是看到了风雨中的彩虹!

参考链接:

http://stackoverflow.com/questions/12900373/idea-javac-source-release-1-7-requires-target-release-1-7

发表评论

表情:
评论列表 (有 0 条评论,255人围观)

还没有评论,来说两句吧...

相关阅读