【问题标题】:cannot implement correctly spring security to pom.xml无法正确实现 pom.xml 的 spring 安全性
【发布时间】:2021-05-07 00:06:53
【问题描述】:

堆栈溢出社区用户,我的项目中的 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.

我做了什么:

右键单击项目> maven > 更新项目 运行项目>清理

一旦我删除了 spring-security 依赖项,错误就会消失,但我正在尝试在我的学习课程项目中实施 spring security,但由于上述原因我不能,请帮助!

感谢转发

【问题讨论】:

  • @khelwood 感谢您的更正,已经纠正了我的错误!,谢谢
  • 您有不受限制的互联网连接吗?或者你是不是例如必须使用代理服务器,可能配置不正确?
  • @dunni 解决了问题,删除所有依赖重新下载,谢谢!
  • 欢迎来到 Stack Overflow!请不要将解决方案公告编辑到问题中。接受(即单击旁边的“勾号”)现有答案之一,如果有的话。如果现有答案尚未涵盖您的解决方案,您还可以创建自己的答案,甚至接受它。
  • @Yunnosch 你的建议非常有用,我接受它!谢谢!

标签: java spring spring-boot maven spring-security


【解决方案1】:

这个错误的解决方法很简单,去maven仓库文件夹删除.m2

然后进入STS spring tool suite或者Eclipse,右键,maven,更新项目,等到所有依赖下载完,错误就会消失

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-22
    • 2020-06-25
    • 2017-08-06
    • 1970-01-01
    • 2015-03-14
    • 1970-01-01
    • 2017-05-15
    • 2014-04-22
    相关资源
    最近更新 更多