Maven 构建:403 禁止
Posted
技术标签:
【中文标题】Maven 构建:403 禁止【英文标题】:Maven Build : 403 Forbidden 【发布时间】:2022-01-15 04:35:46 【问题描述】:当我尝试构建一个 spring-boot 项目时,我收到特定存储库的 403 Forbidden 错误。这会导致构建失败。
依赖:
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-web -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.5.0-M1</version>
</dependency>
错误:
[WARNING] Could not transfer metadata net.minidev:json-smart/maven-metadata.xml from/to
SpringFramework (https://maven.springframework.org/milestone/): Authorization failed for
https://maven.springframework.org/milestone/net/minidev/json-smart/maven-metadata.xml 403
Forbidden
[WARNING] The POM for org.springframework.security:spring-security-web:jar:5.5.0-M1 is
missing, no dependency information available
[WARNING] The POM for org.springframework.security:spring-security-config:jar:5.5.0-M1 is
missing, no dependency information available
[WARNING] The POM for org.springframework.security:spring-security-core:jar:5.5.0-M1 is
missing, no dependency information available
[ERROR] Failed to execute goal on project gtt-v2-sample-track-salesorders-service: Could not
resolve dependencies for project com.sap.gtt.v2:gtt-v2-sample-track-salesorders-
service:jar:1.0.0: The following artifacts could not be resolved:
org.springframework.security:spring-security-web:jar:5.5.0-M1,
org.springframework.security:spring-security-config:jar:5.5.0-M1,
org.springframework.security:spring-security-core:jar:5.5.0-M1: Failure to find
org.springframework.security:spring-security-web:jar:5.5.0-M1 in
https://maven.springframework.org/milestone/ was cached in the local repository, resolution
will not be reattempted until the update interval of SpringFramework has elapsed or updates are forced -> [Help 1]
我检查了 Maven 存储库,它被称为里程碑存储库。不知道该怎么办,请帮我解决这个问题。
【问题讨论】:
您可以尝试使用存储库的 urlhttps://repo.spring.io/milestone
吗?
@dunni 成功了,谢谢
【参考方案1】:
如果您想使用 Spring Milestones 或 Release Candidates,您需要将以下存储库添加到您的 pom.xml
:
<repositories>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
如果您只想使用已发布的 Spring 版本,则无需将任何新存储库添加到 pom.xml
,因为所有发布工件都已发布到 Maven Central,但在这种情况下,您可能希望将依赖项更改为:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.5.0</version>
</dependency>
【讨论】:
存储库方案必须为https:
。 http:
正在返回 403。它最迟在 2021 年 10 月 27 日通过 302 重定向。但是,今天(2022 年 1 月 4 日)是硬 403。
谢谢!我已经相应地更新了我的答案。【参考方案2】:
我觉得版本有问题,你可以试试这个:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.5.0</version>
</dependency>
参考:https://mvnrepository.com/artifact/org.springframework.security/spring-security-web/5.5.0
【讨论】:
以上是关于Maven 构建:403 禁止的主要内容,如果未能解决你的问题,请参考以下文章