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

IntelliJ执行mvn clean install无法下载Maven依赖的解决方法求助

Maven依赖下载403 Forbidden问题解决方法

报错原因

报错核心是配置的Maven仓库地址为https://mvnrepository.com/,这个网站仅用于查询Maven依赖信息,并不提供直接的依赖下载服务,因此请求会返回403 Forbidden。

解决步骤

  • 修改Maven全局配置的仓库地址
    打开本地Maven的settings.xml(路径通常是~/.m2/settings.xml或Maven安装目录下的conf/settings.xml),找到<repositories>节点,把指向https://mvnrepository.com/的仓库替换为官方或可靠的公共仓库,示例配置如下:

    <repository>
        <id>central</id>
        <url>https://repo1.maven.org/maven2/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <!-- 针对JBoss相关依赖,可添加JBoss官方仓库 -->
    <repository>
        <id>jboss-public-repository-group</id>
        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    
  • 检查项目pom.xml中的仓库配置
    如果项目自身的pom.xml里也配置了https://mvnrepository.com/仓库,同样替换为上述可用仓库地址。

  • 清理缓存并重试构建
    执行以下命令清理本地Maven缓存,并强制更新依赖信息后重新构建:

    mvn clean install -U
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.12 10:15:15