当前位置: 首页 > news >正文

reason: the Java file contained parse errors

今天用Maven打包项目时发生一个错误:
file: D:\workspace\echoo2.0-xxx-xxx-portal\src\main\java\com\echoo\service\impl\DecDataServiceImpl.java; reason: the Java file contained parse errors

打包报错显示这个类解析错误
在IDEA中没有任何错误提示

问题所在:
代码中用了jdk14的新特性,一个新的数据结构 record

	// 定义了一个record类型的对象private record Result(byte[] dataKeyByte, byte[] dataIvByte) {}private Result getResult(DeliveryEncKey deliveryEncKey) throws Exception {String dataKey = AESGCMUtil.decrypt(AESGCMUtil.hexStringToByteArray(deliveryEncKey.getEncryptionKey()),aesGCMConf.getMasterKey(), aesGCMConf.getMasterIv());String dataIV = AESGCMUtil.decrypt(AESGCMUtil.hexStringToByteArray(deliveryEncKey.getIv()),aesGCMConf.getMasterKey(), aesGCMConf.getMasterIv());byte[] dataKeyByte = AESGCMUtil.hexStringToByteArray(dataKey);byte[] dataIvByte = AESGCMUtil.hexStringToByteArray(dataIV);return new Result(dataKeyByte, dataIvByte);}

项目用的是jdk17,这是IDEA没有报错的原因,因为这个语法jdk17是完全支持的
在这里插入图片描述
但是用Maven打包或者编译时却报了无法解析的错
看了一下pom编译配置:

            <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version> <!-- 使用与你的Maven版本兼容的最新版本 --><configuration><source>17</source><target>17</target></configuration></plugin>

Maven的jdk版本

PS D:\workspace\xxxxx> mvn -version
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
Maven home: D:\tools\apache-maven-3.9.1
Java version: 17.0.5, vendor: Oracle Corporation, runtime: D:\tools\JDK17
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

也找不到什么问题

这时候俺再仔细看了一下报错:
Caused by: net.revelc.code.impsort.ex.ImpSortException: file: D:\workspace\dm2.0-api-for-courier-admin-portal\src\main\java\com\hkt\it\ds\ruby\dmg\courieradmin\service\impl\DecDataServiceImpl.java; reason: the Java file contained parse errors

发现这个ImpSortException好像是一个第三方的异常,
仔细看了看pom文件,发现项目用了一个第三方插件impsort-maven-plugin

            <plugin><groupId>net.revelc.code</groupId><artifactId>impsort-maven-plugin</artifactId><executions><execution><id>sort-imports</id><goals><goal>sort</goal></goals><phase>process-sources</phase></execution></executions></plugin>

这个插件是他们用来做代码排序的,注释掉这个插件就build success了
在这里插入图片描述
垃圾插件!!!
去这个插件的官方文档看了看
在这里插入图片描述
1.9.0版本是2023-05-09日更新的
在这里插入图片描述
jdk14于2020年3月17日正式发布,它竟然不支持?
垃圾插件!!!

http://www.lryc.cn/news/376643.html

相关文章:

  • 使用密钥对登录服务器
  • 面试_多线程
  • 跨境电商必备?揭秘原生IP的作用
  • mysql竖表变横表不含聚合
  • application/x-www-form-urlencoded和json的区别
  • oracle数据库日常保养或巡检语句实践整理汇总
  • Elasticsearch 第一期:基础的基础概念
  • MySQL数据库笔记(二)
  • 谷歌邮箱:2024年最全使用指南及技巧
  • 工业设计初学者手册——第四部分:制造工艺
  • Scala语言:大数据开发的未来之星 - 零基础到精通入门指南
  • Springboot整合Zookeeper分布式组件实例
  • Python | 使用Matplotlib生成子图的示例
  • 云原生巡检监控报告
  • Linux系统编程——部分内容补充
  • 数学建模基础:非线性模型
  • Kotlin 语言基础学习
  • Kafka 之 KRaft —— 配置、存储工具、部署注意事项、缺失的特性
  • 专业和学校到底怎么选,兴趣和知名度到底哪个重要?
  • 【MySQL】数据库
  • D111FCE01LC2NB70带流量调节派克比例阀
  • buuctf-findKey
  • 针对oracle系列数据库慢数据量大的问题
  • Nginx-Rewrite
  • 2024 年 Python 基于 Kimi 智能助手 Moonshot Ai 模型搭建微信机器人(更新中)
  • 关于接口多态,何时使用接口名创建对象?何时使用子类创建对象?
  • 短视频热恋进行时:成都柏煜文化传媒有限公司
  • springBoot多数据源使用、配置
  • 打破安全设备孤岛,多源威胁检测与响应(XDR)如何构建一体化安全防线
  • Android SurfaceFlinger——概述(一)