博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
maven-compiler-plugin 指定jdk的版本和编码
阅读量:7037 次
发布时间:2019-06-28

本文共 3178 字,大约阅读时间需要 10 分钟。

为了让maven的jdk编译版本一致, 使用maven-compiler-plugin插件来协助管理

建议新建maven项目后的第一步就是配置该插件

org.apache.maven.plugins
maven-compiler-plugin
1.7
1.7

 

使用encoding参数课解决java文件的编码问题

org.apache.maven.plugins
maven-compiler-plugin
default-compile
compile
compile
UTF-8

 

合起来就是

org.apache.maven.plugins
maven-compiler-plugin
3.3
1.7
1.7
UTF8

 

默认jdk版本不匹配出现的异常信息为

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project springJMS: Compilation failure: Compilation failure:  [ERROR] /home/frank/programcode/SpringJMSSample/src/main/java/huangbowen/net/jms/MessageSender.java:[6,1] error: annotations are not supported in -source 1.3  [ERROR]   [ERROR] (use -source 5 or higher to enable annotations)  [ERROR] /home/frank/programcode/SpringJMSSample/src/main/java/net/EmbedBrokerApp.java:[5,7] error: static import declarations are not supported in -source 1.3  [ERROR] -> [Help 1]  [ERROR]   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  [ERROR] Re-run Maven using the -X switch to enable full debug logging.  [ERROR]   [ERROR] For more information about the errors and possible solutions, please read the following articles:  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

 

jdk1.8 的配置: 

org.apache.maven.plugins
maven-compiler-plugin
3.6.1
1.8
1.8
org.apache.maven.plugins
maven-resources-plugin
3.0.2
UTF-8

 

scala 2.11.12 的配置

net.alchim31.maven
scala-maven-plugin
3.2.2
compile
testCompile

 

转载地址:http://xunal.baihongyu.com/

你可能感兴趣的文章
我的友情链接
查看>>
中小企业是否需要邮件服务器系统
查看>>
关机命令
查看>>
禁止浏览器缓存的响应头和定时刷新
查看>>
Win8.1下安装Sass Compass
查看>>
sjtu oj 1250 最大连续子序列问题变形
查看>>
OSPF在企业网络中的应用
查看>>
运维核心之一 CMDB
查看>>
python高性能编程--002--全局解释器锁GIL
查看>>
VSS 信息安全
查看>>
python基础学习笔记
查看>>
Java的HashMap和HashTable
查看>>
我的友情链接
查看>>
windows系统之WSUS服务器:更改WSUS更新文件的路径
查看>>
Btrace
查看>>
我的友情链接
查看>>
python抓取豆瓣妹子图片并上传到七牛
查看>>
关于Spring Data redis几种对象序列化的比较
查看>>
windows下批处理设置U盘盘符为U【非PE】
查看>>
Windows系统补丁KB2962872导致InstallShield无法启动(解决方案已更新)
查看>>