Gradle Failiure: Could not determine java version from '13.0.1' - java

iam trying to build the MAS project-ubin (https://github.com/project-ubin/ubin-corda) PoC but it seems to be failing on the first step:
./gradlew clean build deployNodes`
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '13.0.1'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I have tried reinstalling both
java and upgrading gradle but to no avail.

The Gradle wrapper script (the 'w' in gradlew) will download the version of Gradle that has been specified for that particular project. You don't have to install or download anything manually. The idea is that you will automatically get the version of Gradle that has been verified to work with the project.
Check the version that is used in gradle/wrapper/gradle-wrapper.properties. For Java 13, you need Gradle 6 or newer. If it is too old and you like to upgrade it, run gradlew wrapper --gradle-version 6.0.1 --distribution-type all.
You can delete your locally installed version of Gradle if you like (or keep it around in case you want to initialize a new project from scratch).

Related

LibGDX gives a gradle error when I try and build my game

Im trying to build my LibGDX game with the command
./gradlew desktop:dist
but it keeps giving this error
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :core:compileJava
Note: E:\Programming\Java\LIBGdx\TextGame\core\src\com\imjustdoom\textgame\stage\PlayGame.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :desktop:dist FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':desktop:dist'.
> Cannot expand ZIP 'E:\Programming\Java\LIBGdx\TextGame\core\build\libs\core-1.0.jar' as it does not exist.
* 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 12s
5 actionable tasks: 4 executed, 1 up-to-date
I am using intelliJ and Java 11 if that matters
I have tried running ./gradlew clean but that didnt help
Im trying to build for desktop
What plugin do you use?
I mean from which plugin does dist task come from? Or is this a custom task?
compileJava task won't produce any artifact like jar file for you, it will only generate class files.
First you have to execute gradlew build that contains assebmle task or gradlew assebmle directly so that jar will be generated in build\libs\ and only after that run gradlew desktop:dist
It's also a question how projects are structured. I see compilation is done on core project, then dist is failing on desktop one, maybe here there is another issue.
So the answer seemed to be downgrading gradlew to 6.7 using. Mustve defaulted to gradle 7 for some reason
./gradlew wrapper --gradle-version 6.7

Could not initialize class org.codehaus.groovy.runtime.InvokeHelper

Spring Boot Project
I'm using gradle 5.2.1 I can't change the version because I'm working on someone else's code. When I build the project in IntelliJ I get the following error:
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokeHelper
I'm using IntelliJ terminal in my code folder with command ./gradlew clean build install.
when I check ./gradle -version it shows JVM: 16.0.2
I feel the problem is with my jdk version.
As per compatibility matrix , only gradle versions of 7 are supporting java 16.
May be you can use older version of jdk which is supporting your current gradle.

Gradle build always fails on different projects

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.
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
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

problem with creating my first HelloWorld app on android studio

these are the errors I receive;
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\AndyKhayaMhlanga\.gradle\daemon\helloWorld3\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Could not create plugin of type 'AppPlugin'.
> com/android/ide/common/blame/MessageReceiver
* 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
CONFIGURE FAILED in 9s
ERROR: Unable to load class 'com.android.ide.common.blame.MessageReceiver'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
You can try some of the things it's suggesting. I would start with syncing Gradle again: in Android Studio, do File -> Sync Project with Gradle Files
This will make sure all dependencies download.
I do believe when you launch a new app Android Studio automatically a TextView saying, "Hello, World" in the center. I this what you want to accomplish?
If not, this has happened to me before perhaps going back to the first version or starting over would help. If you start over go step by step first the layout then snippets of code. And when it doesn't work you'll know what is wrong.
Hope this helps!

Gradle Build Can't Find testSrcDirs

I'm trying to run a Gradle build for an existing Java project, but I get the following error that appears to be unrelated to my project.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':myProject:test'.
> Could not get unknown property 'testSrcDirs' for task ':myProject:test' of type org.gradle.api.tasks.testing.Test.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
How can I fix this error?
If you land on this page searching for the testSrcDir exception, try updating the gradle clover plugin jar from 2.0.1 to latest versions.
If can't update the version you could also try the workaround suggested here
test {
ext.testSrcDirs = project.sourceSets.test.java.srcDirs
}
For me, the issue was that my project needed to be built with Gradle 2.x but I was using Gradle 3.x. Once I reverted my Gradle version, the build worked.

Categories

Resources