首页 > 解决方案 > 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 文件的版本不一致

标签: spring-boot

解决方案


推荐阅读