【问题标题】:Got an error when building spring security from source从源代码构建 Spring Security 时出错
【发布时间】:2020-11-14 22:10:38
【问题描述】:

我需要为我的实验从源代码构建 Spring Security。我按照 githubgithub: spring-security 中的指南运行了命令 $./gradlew install。但是,它返回以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':spring-security-config:compileKotlin'.
> Could not resolve all files for configuration ':spring-security-config:kotlinCompilerClasspath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10.
     Required by:
         project :spring-security-config
      > Could not resolve org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10.
         > Could not get resource 'https://repo.spring.io/libs-snapshot/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.4.10/kotlin-compiler-embeddable-1.4.10.pom'.
            > Could not HEAD 'https://repo.spring.io/libs-snapshot/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.4.10/kotlin-compiler-embeddable-1.4.10.pom'. Received status code 401 from server: Unauthorized
   > Could not resolve org.jetbrains.kotlin:kotlin-bom:1.4.10.
     Required by:
         project :spring-security-config
      > Could not resolve org.jetbrains.kotlin:kotlin-bom:1.4.10.
         > Could not get resource 'https://repo.spring.io/libs-snapshot/org/jetbrains/kotlin/kotlin-bom/1.4.10/kotlin-bom-1.4.10.pom'.
            > Could not GET 'https://repo.spring.io/libs-snapshot/org/jetbrains/kotlin/kotlin-bom/1.4.10/kotlin-bom-1.4.10.pom'. Received status code 401 from server: Unauthorized

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3m 53s

原因是什么?如何解决?

【问题讨论】:

    标签: java gradle spring-security compilation


    【解决方案1】:

    问题在于 Gradle 错误:

    从服务器收到状态码 401:未授权

    该项目正在尝试使用https://repo.spring.io/libs-snapshot 解决依赖关系,该依赖关系被拒绝并以401 HTTP 状态。

    由于 Spring 基础架构团队最近实施的限制,它可能会失败。更多详情见博文:https://spring.io/blog/2020/10/29/notice-of-permissions-changes-to-repo-spring-io-fall-and-winter-2020

    一个潜在的解决方案是修改项目的存储库,以便使用 Maven Central 或 JCenter 等公共存储库。有关详细信息,请参阅 Gradle 的 documentation

    如果 Spring Security 构建需要仅在现在私有 Spring 存储库中可用的工件,则无法保证这是否会起作用。

    【讨论】:

      猜你喜欢
      • 2016-04-13
      • 2015-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      相关资源
      最近更新 更多