佳佳的博客
Menu
首页
【Maven】IDEA自动重置Language level的解决办法
Posted by
佳佳
on 2017-03-29
IT
Maven
IntelliJ IDEA
编译时出现【_错误: -source 1.5 中不支持 `lambda` 表达式_】错误,代码上显示【_Usage of API documented as @since 1.6+_】提示。 在【`Project Structure`】中将对应Model的Language level改成【`Project default(8 - Lambdas, type annotation etc.)`】后,代码上的提示消失了,但是通过`Maven`编译时仍然提示【_错误: -source 1.5 中不支持 `lambda` 表达式_】。 * * * #### 解决方法 ##### 如使用maven-compiler-plugin插件打包可以使用如下方式: ```xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> ``` ##### 通用的简单写法 ```xml <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> ``` * * * ##### 参考 * [intellij 出现"Usage of API documented as @since 1.6+"的解决办法](http://www.cnblogs.com/cxj20160928/p/5954196.html) * [解决IDEA自动重置LanguageLevel和JavaCompiler版本的问题](http://blog.csdn.net/isea533/article/details/48575983) * [stop IntelliJ IDEA to switch java language level everytime the pom is reloaded (or change the default project language level)](http://stackoverflow.com/questions/27037657/stop-intellij-idea-to-switch-java-language-level-everytime-the-pom-is-reloaded)
版权声明:原创文章,未经允许不得转载。
https://www.liujiajia.me/2017/3/29/【maven】idea自动重置language-level的解决办法
“Buy me a nongfu spring”
« 【Spring】上传文件
【Spring】【MVC】接收参数的方式 »
昵称
*
电子邮箱
*
回复内容
*
(回复审核后才会显示)
提交
目录
AUTHOR
刘佳佳
江苏 - 苏州
软件工程师