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

Time:11-13

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

CodePudding user response:

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.

CodePudding user response:

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
  • Related