IntelliJ IDEA 学习笔记 - 【maven插件配置 - 设置JDK版本和默认字符集】
设置JDK版本和默认字符集
- 设置 maven-resources-plugin 插件的默认参数。
- 设置 maven-compiler-plugin 插件的默认参数
<properties>
<!-- 设置在读写过滤资源时使用的字符编码 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 修改 编译所用JDK版本 -->
<maven.compiler.source>1.8</maven.compiler.source>
<!-- 修改 运行所用JDK版本-->
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
可解决警告
File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
以下会自动匹配
参考资料
湖边的小屋圣遗:maven-compiler-plugin 配置 JDK 版本
Apache Maven Compiler Plugin:设置编译与运行的JDK版本
Apache Maven Resources Plugin/ resources:resources