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

Spring Boot 2.7.7(Maven)中ModelMapper依赖‘org.modelmapper:modelmapper:’未找到

解决Maven中ModelMapper依赖找不到的问题

问题原因

报错提示Dependency 'org.modelmapper:modelmapper:' not found,核心原因是你在pom.xml里配置ModelMapper依赖时未指定版本号,Maven无法确定要拉取的依赖包版本,因此抛出找不到依赖的错误。

修复步骤

  1. 补充依赖版本号
    在pom.xml的<dependencies>代码块中,为ModelMapper依赖添加明确的稳定版本号(与Spring Boot 2.7.7适配的常用版本为2.4.4),完整配置如下:
    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>2.4.4</version>
    </dependency>
    
  2. 刷新Maven依赖
    配置完成后,在IDE中执行Maven的clean和compile命令,或点击IDE内的"Maven刷新"按钮,让Maven重新拉取并加载依赖。

额外优化方案

若想统一管理项目依赖版本,可通过Spring Boot的依赖管理机制省略单独的版本声明:
在pom.xml的<dependencyManagement>代码块中添加版本声明:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.4.4</version>
        </dependency>
    </dependencies>
</dependencyManagement>

之后在<dependencies>中引入ModelMapper时,即可省略<version>标签,Maven会自动使用依赖管理中声明的版本。

内容的提问来源于stack exchange,提问作者vishwanath challal

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 06:01:28