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

Java应用编译失败:spring-aot-maven-plugin 0.11.3 401未授权求助

解决Spring AOT Maven插件编译401认证失败问题

问题分析

报错核心是访问https://repo.spring.io/release获取spring-aot-maven-plugin:0.11.3的POM文件时返回401 Unauthorized,说明该仓库已不再允许匿名访问,或你的Maven配置缺少对应认证信息。

可行解决方案

1. 切换到Maven中央仓库

Spring官方已将多数组件(包括实验性插件)同步至Maven Central,修改项目pom.xml,确保仓库配置指向中央仓库:

<repositories>
    <repository>
        <id>central</id>
        <url>https://repo1.maven.org/maven2/</url>
        <releases><enabled>true</enabled></releases>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>https://repo1.maven.org/maven2/</url>
        <releases><enabled>true</enabled></releases>
    </pluginRepository>
</pluginRepositories>

修改后重新执行mvn clean install。

2. 添加Spring仓库认证信息(若必须使用原仓库)

如果业务依赖必须使用repo.spring.io/release,在Maven的settings.xml(路径通常为~/.m2/settings.xml或Maven安装目录下conf/settings.xml)中添加认证配置:

<servers>
    <server>
        <id>spring-releases</id>
        <username>你的Spring平台账号用户名</username>
        <password>你的Spring平台账号密码</password>
    </server>
</servers>

需先在Spring相关平台注册账号获取合法凭据。

3. 升级插件版本

旧版本的Spring AOT插件可能已从公开仓库下线,尝试升级到最新稳定版,修改pom.xml中的插件版本:

<plugin>
    <groupId>org.springframework.experimental</groupId>
    <artifactId>spring-aot-maven-plugin</artifactId>
    <version>最新稳定版本号</version>
    <!-- 保留原有插件配置 -->
</plugin>

4. 清理本地Maven缓存

本地仓库可能存在损坏的缓存文件,执行以下命令强制更新依赖:

mvn clean install -U

内容的提问来源于stack exchange,提问作者Felipe Estima da Silveira

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 18:42:28