Debian 12环境下Spring Boot 3 MVC项目Gradle构建失败排查求助
Debian 12环境下Spring Boot 3 MVC项目Gradle构建失败排查求助
我正在开发一个Spring Boot 3 MVC Web应用,通过Spring Initializr生成了项目骨架,但在Debian 12(Bookworm)系统上用Gradle构建失败。我的环境配置如下:
- 操作系统:Debian 12 (Bookworm)
- JDK:Amazon Corretto Java 21 LTS
- 版本管理工具:SDKMAN!
项目的build.gradle配置
plugins { id 'java' id 'war' id 'org.springframework.boot' version '3.2.1' id 'io.spring.dependency-management' version '1.1.4' } group = '--------' // 已隐藏 version = 'v1' java { sourceCompatibility = '21' } configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-actuator' implementation 'org.springframework.boot:spring-boot-starter-batch' implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-data-redis' implementation 'org.springframework.boot:spring-boot-starter-data-rest' implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-jooq' implementation 'org.springframework.boot:spring-boot-starter-mail' implementation 'org.springframework.boot:spring-boot-starter-oauth2-authorization-server' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.liquibase:liquibase-core' implementation 'org.springframework.kafka:spring-kafka' implementation 'org.springframework.session:spring-session-data-redis' implementation 'org.springframework.session:spring-session-jdbc' implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity6' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' runtimeOnly 'com.h2database:h2' runtimeOnly 'io.micrometer:micrometer-registry-prometheus' runtimeOnly 'org.postgresql:postgresql' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.boot:spring-boot-testcontainers' testImplementation 'org.springframework.batch:spring-batch-test' testImplementation 'org.springframework.kafka:spring-kafka-test' testImplementation 'org.springframework.security:spring-security-test' testImplementation 'org.testcontainers:junit-jupiter' testImplementation 'org.testcontainers:kafka' testImplementation 'org.testcontainers:postgresql' } tasks.named('test') { useJUnitPlatform() }
构建时的错误信息
核心错误提示
FAILURE: Build failed with an exception. * Where: Build file '/home/vyn/dev/projects/freelance/ip-med/kuzbassrw/kuzbassrw/build.gradle' line: 4 * What went wrong: Plugin [id: 'org.springframework.boot', version: '3.2.1'] 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:3.2.1') Searched in the following repositories: Gradle Central Plugin Repository * Try: > Run with --stacktrace option to get the stack trace. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. CONFIGURE FAILED in 4s
详细调试日志片段
2024-01-10T20:50:57.004+0700 [INFO] [org.apache.http.impl.execchain.RetryExec] I/O exception (java.net.SocketException) caught when processing request to {s}->https://plugins.gradle.org:443: Connection reset 2024-01-10T20:50:57.004+0700 [DEBUG] [org.apache.http.impl.execchain.RetryExec] Connection reset java.net.SocketException: Connection reset at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:318) at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346) at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796) at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099) at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:489) at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:483) at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:111) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506) at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1421) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:199) ....... 2024-01-10T20:50:57.106+0700 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] CONFIGURE FAILED in 4s
我的疑问
我到底哪里操作错了?问题根源是什么?
另外有个重要情况:这个项目在Windows 10系统上可以直接构建成功,完全没有问题。
备注:内容来源于stack exchange,提问作者Ярослав Вершинин
相关产品推荐
相关产品推荐

