Reputation: 7328
I am trying to build Gradle projects. Installed Gradle's latest version (6.0.1) using Homebrew. When I try gradle build
in various projects (for example https://github.com/arnabmitra/trustlines-demo), it gives this error:
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
> org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String, org.gradle.api.internal.file.FileResolver, org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)
* 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 1m 25s
Similar errors happened with other projects. It's my first time using Gradle (come from Maven) and what I am trying to do is just compile the project to have .class
files.
Upvotes: 1
Views: 2347
Reputation: 1108
If you are using Kotlin 1.3.10, update Kotlin to at least 1.3.20.
Issue was that Kotlin 1.3.10 uses the DefaultSourceDirectorySet constructor via reflection which has been removed in Gradle 6: https://discuss.gradle.org/t/the-defaultsourcedirectoryset-constructor-has-been-deprecated/29610
Upvotes: 2
Reputation: 691685
Don't use your installation of gradle. Use ./gradlew
. That will automatically download and use the version of gradle that the project uses, instead of an incompatible version.
See https://docs.gradle.org/current/userguide/gradle_wrapper.html
Upvotes: 1