【发布时间】:2021-06-22 13:11:56
【问题描述】:
使用 Spring initializr 与 gradle 一起初始化一个 spring boot 2.5.0 项目(仅提供 Spring web 作为依赖项)。
gradle build/gradle bootRun 总是失败并出现以下错误:
What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.5.0-SNAPSHOT'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.5.0-SNAPSHOT')
Searched in the following repositories:
maven(https://repo.spring.io/milestone)
maven2(https://repo.spring.io/snapshot)
Gradle Central Plugin Repository
settings.gradle
pluginManagement {
repositories {
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
gradlePluginPortal()
}
}
rootProject.name = 'spring-boot'
build.gradle
plugins {
id 'org.springframework.boot' version '2.5.0-SNAPSHOT'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
运行 Windows 10,gradle 6.8.3,从命令行运行会产生相同的结果。请帮忙。
编辑:可以确认我不在代理后面。还尝试暂时禁用防火墙并运行,但没有运气。
运行 gradle --debug build 导致以下结果
2021-03-26T12:28:35.484+0530 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {s}->https://repo.spring.io:443
2021-03-26T12:28:35.484+0530 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to repo.spring.io/35.241.58.96:443
2021-03-26T12:28:35.484+0530 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to repo.spring.io/35.241.58.96:443 with timeout 30000
2021-03-26T12:28:35.501+0530 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled protocols: [TLSv1.2]
2021-03-26T12:28:35.501+0530 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2021-03-26T12:28:35.501+0530 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
2021-03-26T12:28:35.519+0530 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-13: Shutdown connection
2021-03-26T12:28:35.520+0530 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection discarded
日志结束说结果成功?
Received result Success[value=org.gradle.launcher.exec.BuildActionResult@1f9ce3e] from daemon DaemonInfo{pid=9948, address=[<some address> port:55586, addresses:[/0.0.0.0]], state=Idle, lastBusy=1616741885172, context=DefaultDaemonContext[uid=<some uid>,javaHome=<my java home>,daemonRegistryDir=<my gradle dir>,pid=9948,idleTimeout=10800000,priority=NORMAL,daemonOpts=-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
我认为这可能是 SSL 的问题,但我尝试在 repo 链接上使用 http,但也没有用。
【问题讨论】:
标签: spring-boot gradle