You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地M2仓库存在的自定义Spring Boot Starter依赖无法被Maven识别

问题原因及解决方法

问题根源

你的message-app项目POM中,引入message-spring-boot-starter依赖时未指定版本号,Maven无法确定要查找的构件版本,因此抛出Could not find artifact ...:jar:unknown错误。即便你已经将starter安装到本地M2仓库,没有明确版本信息的情况下,Maven无法定位到对应的构件。

解决方法

方法1:直接在依赖中指定版本

修改message-app的POM依赖配置,添加与message-spring-boot-starter一致的版本号:

<dependency>
    <groupId>com.message-starter</groupId>
    <artifactId>message-spring-boot-starter</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

方法2:通过dependencyManagement统一管理版本

如果后续需要维护多个依赖的版本一致性,可以在message-app的POM中添加dependencyManagement节点统一声明版本:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.message-starter</groupId>
            <artifactId>message-spring-boot-starter</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
</dependencyManagement>

配置后,dependencies节点中引入该依赖时无需重复指定版本。

方法3:验证本地M2仓库构件完整性

检查本地M2仓库路径com/message-starter/message-spring-boot-starter/0.0.1-SNAPSHOT下是否存在完整的构件文件(如.jar、.pom)。若文件缺失,回到message-spring-boot-starter项目重新执行mvn clean install命令完成安装。

内容的提问来源于stack exchange,提问作者Kirill Zhurbin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 23:20:33