【问题标题】:Gradle Could not resolve org.springframework.boot:spring-boot-dependencies:Gradle 无法解析 org.springframework.boot:spring-boot-dependencies:
【发布时间】:2021-05-18 06:39:30
【问题描述】:

我遇到了一些错误:

FAILURE:构建失败并出现异常。

  • 出了什么问题:
Execution failed for task ':gisett-backend:compileJava'.
> Could not resolve all dependencies for configuration ':gisett-backend:detachedConfiguration1'.
  > Could not resolve org.springframework.boot:spring-boot-dependencies:2.0.3.RELEASE.
    Required by:
        project :gisett-backend
     > Could not resolve org.springframework.boot:spring-boot-dependencies:2.0.3.RELEASE.
        > Could not get resource 'http://repo.boundlessgeo.com/main/org/springframework/boot/spring-boot-dependencies/2.0.3.RELEASE/spring-boot-dependencies-2.0.3.RELEASE.pom'.
           > Could not HEAD 'http://repo.boundlessgeo.com/main/org/springframework/boot/spring-boot-dependencies/2.0.3.RELEASE/spring-boot-dependencies-2.0.3.RELEASE.pom'.
              > No such host is known (repo.boundlessgeo.com)
     > Could not resolve org.springframework.boot:spring-boot-dependencies:2.0.3.RELEASE.
        > Could not get resource 'http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.3.RELEASE/spring-boot-dependencies-2.0.3.RELEASE.pom'.
           > Could not HEAD 'http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.0.3.RELEASE/spring-boot-dependencies-2.0.3.RELEASE.pom'. Received status code 501 from server: HTTPS Required

我该如何解决?

更新:

它有部分帮助,现在我明白了:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':gisett-backend'.
> Could not resolve all artifacts for configuration ':gisett-backend:classpath'.
  > Could not resolve io.spring.gradle:propdeps-plugin:0.0.9.RELEASE.
    Required by:
        project :gisett-backend
     > Could not resolve io.spring.gradle:propdeps-plugin:0.0.9.RELEASE.
        > Could not get resource 'https://repo.spring.io/libs-snapshot/io/spring/gradle/propdeps-plugin/0.0.9.RELEASE/propdeps-plugin-0.0.9.RELEASE.pom'.
           > Could not HEAD 'https://repo.spring.io/libs-snapshot/io/spring/gradle/propdeps-plugin/0.0.9.RELEASE/propdeps-plugin-0.0.9.RELEASE.pom'. Received status code 401 from server: Unauthorized

更新 2: 我修复了它(我更新了服务器列表),但现在又出现了一个错误:

配置项目 ':gisett-backend' 时出现问题。

无法解析配置“:gisett-backend:classpath”的所有工件。 找不到 io.spring.gradle:propdeps-plugin:0.0.9.RELEASE。 在以下位置搜索: - https://repo.maven.apache.org/maven2/io/spring/gradle/propdeps-plugin/0.0.9.RELEASE/propdeps-plugin-0.0.9.RELEASE.pom - https://repo.spring.io/snapshot/io/spring/gradle/propdeps-plugin/0.0.9.RELEASE/propdeps-plugin-0.0.9.RELEASE.pom - https://plugins.gradle.org/m2/io/spring/gradle/propdeps-plugin/0.0.9.RELEASE/propdeps-plugin-0.0.9.RELEASE.pom

这是来自 build.gradle 的部分:


buildscript {


    ext {
        springBootVersion = '2.0.1.BUILD-SNAPSHOT'
    }
    repositories {
        mavenCentral()
        maven { url 'https://repo.spring.io/snapshot/' }
        maven { url "https://plugins.gradle.org/m2/" }
        //for finding propdeps-plugin dependency

    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
        classpath "com.moowork.gradle:gradle-node-plugin:1.2.0"

       // classpath 'io.spring.gradle:propdeps-plugin:0.0.9.RELEASE'

    }

}



//...


// In this section you declare where to find the dependencies of your project
repositories {
    maven { url "https://repo.spring.io/plugins-release" }
//...

    maven { url "https://repo.maven.apache.org/maven2" }
}



}

//...


我该如何解决? 谢谢

【问题讨论】:

    标签: java spring-boot maven gradle-kotlin-dsl


    【解决方案1】:

    尝试更改您的 build.gradle 应该如下所示:

    buildscript {
        ext {
            springBootVersion = '2.0.3.BUILD-SNAPSHOT'
        }
        repositories {
            mavenCentral()
            maven { url 'https://repo.spring.io/libs-snapshot' }
        }
        dependencies {
            classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
        }
    }
    
    apply plugin: 'java'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    

    【讨论】:

    猜你喜欢
    • 2017-06-18
    • 1970-01-01
    • 2022-01-07
    • 2019-07-29
    • 2023-01-11
    • 2017-02-25
    • 2019-01-27
    • 1970-01-01
    • 2018-09-14
    相关资源
    最近更新 更多