我是一个入门的Gradle项目,并正在努力构建一个项目。
我在运行gradle -PmainClass run
时收到此错误
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:28.2-jre.
Required by:
project :
> Could not resolve com.google.guava:guava:28.2-jre.
> Could not get resource 'https://jcenter.bintray.com/com/google/guava/guava/28.2-jre/guava-28.2-jre.pom'.
> Could not GET 'https://jcenter.bintray.com/com/google/guava/guava/28.2-jre/guava-28.2-jre.pom'.
> sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
* 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 11s
1 actionable task: 1 executed
我试图在这里运行一个Java应用程序,方法是遵循this post中的第一个示例。
为了澄清这一点,我确实有一个互联网连接。我想知道我是否需要某种证书。
这是我的build.gradle
/*
* 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.3/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.
jcenter()
}
dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:28.2-jre'
implementation files('./lib/jython-standalone-2.7.0.jar')
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
application {
// Define the main class for the application.
mainClassName = 'Zumi.App'
}
任何帮助都是非常感谢的。谢谢!
发布于 2022-03-21 03:45:29
将mavenCentral()添加到存储库块中,
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.
jcenter()
mavenCentral()
}
dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:28.2-jre'
implementation files('./lib/jython-standalone-2.7.0.jar')
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
application {
// Define the main class for the application.
mainClassName = 'Zumi.App'
}
https://stackoverflow.com/questions/71551809
复制相似问题