Reputation: 128
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.
Upvotes: 2
Views: 28569
Reputation: 89
An alternative reason for this error is that pom.xml states a maven version different than the one you are actually using. I had in my pom.xml
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
I fixed the problem by changing the line to:
<url>https://repo1.maven.org/maven3/</url>
Upvotes: 0
Reputation: 17470
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>https://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>
Upvotes: 4
Reputation: 165
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
Upvotes: 0