Search code examples
javaclassloadergradle

Run Gradle with verbose class loading?


My build script is encountering an error (below). Is there a way to run Gradle with the same type of output as invoking Java with -verbose:class?

The error in question, should anyone have some input:

Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':Project:compile'.
    at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:49)
    ... more
Caused by: java.lang.LinkageError: loader constraints violated when linking org/apache/ivy/core/module/descriptor/DependencyDescriptor class

Solution

  • You can set the following environment variable, I believe...

    GRADLE_OPTS="$GRADLE_OPTS -verbose:class"
    

    and then invoke gradle. Read this link.

    Once Gradle is downloaded and unzipped, the environment variable GRADLE_HOME can be set to the directory of the unzipped Gradle installation and the PATH should be set to $GRADLE_HOME/bin or %GRADLE_HOME%\bin. The Gradle installation page tells us that JVM options used by Gradle can be set via either GRADLE_OPTS or JAVA_OPTS. The Grade installation and configuration in the path can be confirmed by running gradle -v at the command line once the environment variable settings are sourced.