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

IntelliJ无法搜索添加Maven依赖问题求助(Ultimate版/JDK17)

解决IntelliJ Ultimate中Maven依赖搜索失败的方案

刷新并更新Maven仓库索引

  • 打开IntelliJ设置(Windows/Linux:Ctrl+Alt+S;Mac:Cmd+,),导航到Build, Execution, Deployment > Build Tools > Maven > Repositories
  • 选中当前使用的仓库,点击Update按钮触发索引刷新,等待索引同步完成后重试依赖搜索
  • 若默认仓库索引更新慢,可在Maven用户配置文件(Settings > Maven > User Settings File对应路径)中添加国内镜像,示例配置:
    <mirrors>
        <mirror>
            <id>aliyunmaven</id>
            <mirrorOf>central</mirrorOf>
            <url>https://maven.aliyun.com/repository/public</url>
        </mirror>
    </mirrors>
    
    配置完成后点击工具栏的Reload All Maven Projects按钮刷新项目

检查IntelliJ的Maven导入配置

  • 进入Settings > Build, Execution, Deployment > Build Tools > Maven > Importing,确保勾选Automatically download: Sources和Automatically download: Documentation
  • 检查VM options for importer中是否存在影响网络的代理参数,如有多余配置可临时移除
  • 重启IntelliJ后重新打开项目,再尝试搜索依赖

确认JDK与Maven的兼容性

  • 打开项目结构窗口(Ctrl+Alt+Shift+S),在Project Settings > Project中设置Project SDK为Oracle OpenJDK 17
  • 进入Settings > Build, Execution, Deployment > Build Tools > Maven > Runner,将JRE设置为与项目一致的OpenJDK 17,避免版本不匹配导致依赖解析异常

重置本地Maven仓库索引

  • 关闭IntelliJ,找到本地Maven仓库下的.index文件夹(通常路径为~/.m2/repository/.index),删除该文件夹内所有文件
  • 重新启动IntelliJ,等待Maven自动重建索引,完成后再次尝试搜索依赖

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 21:03:15