Benjiboy50Fonz
Benjiboy50Fonz

Reputation: 23

Gradle not resolving JRE dependency

I am a beginner with Gradle projects and am struggling to build a project.

I am receiving this error when running 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

I am trying to run a Java application here by following the first example in this post.

For clarification, I do have an internet connection. I'm wondering if there is some sort of certificate I need.

Here is my 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'
}

Any help is appreciated. Thanks!

Upvotes: 1

Views: 345

Answers (1)

Suresh Chaudhary
Suresh Chaudhary

Reputation: 698

Add mavenCentral() to your repositories block,

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'
}

Upvotes: 1

Related Questions