Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE.

Java 2021-08-27 阅读 63 评论 0

问题描述

今天打开 Java 项目,编译的时候竟然出错了,以前都好好的,错误如下:

Starting Gradle Daemon...
Gradle Daemon started in 3 s 566 ms

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'demo'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.2.2.RELEASE
      > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE.
         > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.2.2.RELEASE/spring-boot-gradle-plugin-2.2.2.RELEASE.pom'.
            > Could not HEAD 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.2.2.RELEASE/spring-boot-gradle-plugin-2.2.2.RELEASE.pom'.
               > Connect to plugins.gradle.org:443 [plugins.gradle.org/104.18.191.9, plugins.gradle.org/104.18.190.9, plugins.gradle.org/2606:4700:0:0:0:0:6812:be09, plugins.gradle.org/2606:4700:0:0:0:0:6812:bf09] failed: No route to host (connect failed)
   > Could not resolve io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE.
     Required by:
         project : > io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.0.8.RELEASE
      > Could not resolve io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE.
         > Could not get resource 'https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.8.RELEASE/dependency-management-plugin-1.0.8.RELEASE.pom'.
            > Could not GET 'https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.8.RELEASE/dependency-management-plugin-1.0.8.RELEASE.pom'.
               > Connection reset

* 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

CONFIGURE FAILED in 3m 25s

build.gradle 内容如下:

plugins {
    id 'org.springframework.boot' version '2.2.2.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
    ....
}

解决方法

尝试添加仓库地址,https://plugins.gradle.org/m2/。如下:

repositories {
    mavenCentral()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}

重新编译。

最后更新 2021-08-27
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });