不能正确实现pom.xml的spring安全性



stack overflow社区用户,我在我的项目中有这个奇怪的问题:

如果我加上这个:

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

在pom.xml

发生这种情况:

sts: spring tools套件,在pom的第一行显示此错误:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Failure to transfer org.springframework.security:spring-security-core:jar:5.4.2 from https://repo.maven.apache.org/maven2 was cached in the local 
repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact 
org.springframework.security:spring-security-core:jar:5.4.2 from/to central (https://repo.maven.apache.org/maven2): Permission denied: no further information 
org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer org.springframework.security:spring-security-core:jar:5.4.2 from https://
repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are 
forced.

我做了什么:

右键点击项目>maven在更新项目跑project>干净的

一旦我删除spring-security依赖,错误就消失了,但我正试图在我的学习课程项目中实现spring安全,但由于上面解释的原因,我无法实现,请帮助!

thanks in forward

这个错误的解决方案很简单,去maven存储库文件夹并删除它。m2

然后转到STS spring工具套件或Eclipse,右键单击maven,更新项目,等到所有依赖项下载完成后,错误就会消失

我希望这个解决方案对遇到相同问题的其他用户有用。

最新更新