无法正确实现pom.xml的Spring Security

jdg4fx2g  于 2021-07-24  发布在  Java
关注(0)|答案(1)|浏览(433)

堆栈溢出社区用户,我的项目中的spring安全实现有一个奇怪的问题:
如果我加上这个:

<!-- 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工具套件,在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.

我所做的:
在project>maven>updateproject上右键单击run project>clean
一旦我删除了Spring Security 依赖项,错误就消失了,但是我正在尝试在我的学习课程项目上实现Spring Security ,但是由于上面解释的原因,我不能,请帮助!
谢谢你在福沃德

dced5bon

dced5bon1#

这个错误的解决方法很简单,转到maven repository文件夹并删除它
然后转到sts-spring工具套件或eclipse,右键单击,maven,update-project,等待所有依赖项下载完毕,然后,错误将消失
我希望这个解决方案应该对其他有同样经历的用户有用

相关问题