Home > database >  Maven Build : 403 Forbidden
Maven Build : 403 Forbidden

Time:12-10

when I try to build a spring-boot project I am getting 403 Forbidden errors for a particular repository. This causes the build to fail.

Dependency:

<!-- 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>

Error:

[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]

I checked in the Maven Repository it is mentioned like milestone repository. Not sure what do, please help me with this issue.

CodePudding user response:

I think problem about version, can you try this :

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>5.5.0</version>
</dependency>

refer : https://mvnrepository.com/artifact/org.springframework.security/spring-security-web/5.5.0

CodePudding user response:

If you want to use Spring Milestones or Release Candidates you need to add the following repository to your pom.xml:

<repositories>
    <repository> 
        <id>repository.spring.milestone</id> 
        <name>Spring Milestone Repository</name> 
        <url>http://repo.spring.io/milestone</url> 
    </repository>
</repositories>

If you just want to use released Spring versions there is no need to add any new repository into the pom.xml because all release artifacts are published to Maven Central, but in this case you might want to change the dependency to:

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>5.5.0</version>
</dependency>
  • Related