我想知道如何解决这个问题:
**.local ~/Hello **
╰─➤ gradle run
╰─➤ gradle run
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve com.google.guava:guava:29.0-jre.
Required by:
project :
> Could not resolve com.google.guava:guava:29.0-jre.
> Could not get resource 'https://repo.maven.apache.org/maven2/com/google/guava/guava/29.0-jre/guava-29.0-jre.pom'.
> Could not GET 'https://repo.maven.apache.org/maven2/com/google/guava/guava/29.0-jre/guava-29.0-jre.pom'.
> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/8.0.2/userguide/build_environment.html#gradle_system_properties
> PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
* 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
BUILD FAILED in 405ms
1 actionable task: 1 executed
**java -version ** 1 ↵
openjdk version "1.8.0_362"
OpenJDK Runtime Environment Corretto-8.362.08.1 (build 1.8.0_362-b08)
OpenJDK 64-Bit Server VM Corretto-8.362.08.1 (build 25.362-b08, mixed mode)
我正在尝试运行以下测试文件。
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* User Manual available at https://docs.gradle.org/6.5/userguide/tutorial_java_projects.html
*/
plugins {
// Apply the java plugin to add support for Java
id 'java'
// Apply the application plugin to add support for building a CLI application.
id 'application'
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}
dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:29.0-jre'
// Use JUnit Jupiter API for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
}
application {
// Define the main class for the application
mainClass = 'hello.App'
}
test {
// Use junit platform for unit tests
useJUnitPlatform()
}
gradle -版本
Gradle 8.0.2
构建时间:2023-03-03 16:41:37 UTC修订版本:7 d 6581558 e226 a580 d91 d399 f7 dfb 9 e3095 c2b 1d的一个例子
Kotlin:1.8.10 Groovy:3.0.13蚂蚁:Apache Ant(TM)版本1.10.11编译于2021年7月10日JVM:1.8.0_362(Amazon.com Inc. 25.362-b 08)操作系统:Mac OS X 13.2.1 aarch64`
多谢了。
1条答案
按热度按时间ac1kyiln1#
Gradle错误确实表明了一些可能的原因:
服务器可能不支持客户端请求的TLS协议版本:(TLSv1.2、TLSv1.3)。您可能需要配置客户端以允许使用其他协议。请参阅:https://docs.gradle.org/8.0.2/userguide/build_environment.html#gradle_system_properties
如果这是真正的原因,您可能需要允许TLSv1.1。但是考虑到这是maven中心,我希望它在大多数时候不需要任何额外的配置。
尝试安装不同/更高版本的Java,而不是1.8和Amazon版本。Amazon Corretto有自己的安全补丁:
https://aws.amazon.com/blogs/opensource/tls-1-0-1-1-changes-in-openjdk-and-amazon-corretto/