spring-boot - Spring Boot Starter Tomcat 2.3.9 javax/注释不一致
问题描述
Spring Boot Starter Tomcat 2.3.9.RELEASE 具有依赖项
jakarta.annotation » jakarta.annotation-api 1.3.5
和
org.apache.tomcat.embed » tomcat-embed-core 9.0.43
如果我们使用BanDuplicateClasses规则运行 maven enforcer 插件,则会出现错误
<banDuplicateClasses>
<findAllDuplicates>true</findAllDuplicates>
<ignoreWhenIdentical>true</ignoreWhenIdentical>
</banDuplicateClasses>
[警告] 规则 0:org.apache.maven.plugins.enforcer.BanDuplicateClasses 失败并显示消息:找到重复的类:
发现于:jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile org.apache.tomcat:tomcat-annotations-api:jar:9.0.43:compile 重复类:javax/annotation/PreDestroy.class javax /annotation/Resource$AuthenticationType.class javax/annotation/Generated.class javax/annotation/security/DeclareRoles.class javax/annotation/Priority.class javax/annotation/Resource.class javax/annotation/security/DenyAll.class javax/annotation /security/RunAs.class javax/annotation/security/PermitAll.class javax/annotation/security/RolesAllowed.class javax/annotation/Resources.class javax/annotation/PostConstruct.class javax/annotation/sql/DataSourceDefinition.class
如果将 jakarta.annotation-api 更新为 2.0.0,错误就会消失。但它看起来像spring-boot-dependencies bom 文件的版本不一致
解决方案
推荐阅读
- java - 通过 Graph API 和自定义请求发送主动消息我收到 401 未授权
- c# - SSH.NET 如何运行程序然后断开与 ssh 的连接,保持程序仍在运行?
- ios - SwiftUI - 嵌套导航链接
- c# - C# WPF.Net Core 无法从其他线程关闭窗口
- python - 如何在鼠标滚轮事件期间获取 pyqtgraph plotwidget 的 objectName?
- css - 如何避免绝对定位的隐藏元素在显示时与其他元素重叠?
- javascript - 从(promise)可观察的映射到更深的领域,这是一个数组并在 html 中使用,角度
- nspredicate - 通过比较行中的 2 个日期来过滤 NSPredicate 中的行
- ios - UITabBarController 使用多个故事板
- python - 并非字典的所有键都存在于 CSV 中