Eclipse下Maven Camel项目添加camel-http4依赖报缺失构件错误
问题触发原因
- 组件命名调整:Camel 3.x版本对HTTP组件做了更名,Camel 2.x版本中基于HttpClient 4.x的
camel-http4组件,在3.x版本中直接更名为camel-http,你使用的3.11.1版本不存在camel-http4构件,因此首先抛出缺失camel-http4的错误。 - Starter依赖groupId错误:Camel 3.x的Spring Boot Starter组件的groupId统一为
org.apache.camel.springboot,而非核心组件使用的org.apache.camel,你之前写的camel-http-starter在org.apache.camel组下不存在,因此仍然提示构件缺失。
解决方案
删除你当前配置的所有HTTP相关依赖,替换为如下配置即可,因为你已经在dependencyManagement中导入了Camel Spring Boot BOM,不需要额外指定版本号:
<!-- Camel HTTP Spring Boot Starter 会自动传递核心camel-http依赖,无需单独引入核心包 --> <dependency> <groupId>org.apache.camel.springboot</groupId> <artifactId>camel-http-starter</artifactId> </dependency>
配置完成后重新执行Maven更新项目即可解决报错。
内容的提问来源于stack exchange,提问作者BenW
相关产品推荐
相关产品推荐

