"Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0."

A new error message: "Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.", making it impossible to build and run Mafia with './gradlew clean runShadow'.

I don't really know much about Gradle; is there a simple solution?
 

MCroft

Developer
Staff member
So, the short answer for me was ./gradlew clean && ./gradlew runShadow or just running it from my IDE.

The full error tells you how to set it up "properly", which is to set the relationship between cleanest and runShadow. Look at "What went wrong" below...

We probably shouldn't, since there isn't really a dependency relationship.


Bash:
Michaels-MBP:kolmafia mcroft$ ./gradlew clean RunShadow

> Configure project :
[versioning] WARNING - the working copy has unstaged or uncommitted changes.

> Task :getRevision

Revision: 27800-M

> Task :shadowJar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':shadowJar' (type 'ShadowJar').
  - Gradle detected a problem with the following location: '/Users/mcroft/projects/kolmafia/dist/KoLmafia-27800-M.jar'.
    
    Reason: Task ':cleanDist' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':shadowJar' as an input of ':cleanDist'.
      2. Declare an explicit dependency on ':shadowJar' from ':cleanDist' using Task#dependsOn.
      3. Declare an explicit dependency on ':shadowJar' from ':cleanDist' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.5/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 4s
8 actionable tasks: 4 executed, 2 from cache, 2 up-to-date
Michaels-MBP:kolmafia mcroft$ ./gradlew clean && ./gradlew runShadow

> Configure project :
[versioning] WARNING - the working copy has unstaged or uncommitted changes.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 1s
2 actionable tasks: 1 executed, 1 up-to-date

> Configure project :
[versioning] WARNING - the working copy has unstaged or uncommitted changes.

> Task :getRevision

Revision: 27800-M

> Task :runShadow

KoLmafia r27800-M
Build main-6d957cc-M 18.0.2.1 (Eclipse Adoptium 18.0.2.1+1) Mac OS X x86_64 14.3

Currently Running on Mac OS X
Local Directory is /Users/mcroft/Library/Application Support/KoLmafia
Using Java 18.0.2.1

<===========--> 90% EXECUTING [2m 18s]
> :runShadow
 
Thanks; I'll go with a bit of a clean, then a separate run. I'm not sure where I'd picked up the all-in-one version from; as I say, I'm a little ignorant when it comes to Gradle!

Thank you!
 

heeheehee

Developer
Staff member
The full error tells you how to set it up "properly", which is to set the relationship between cleanest and runShadow. Look at "What went wrong" below...

We probably shouldn't, since there isn't really a dependency relationship.
I don't see any logical issues with adding `shadowJar.mustRunAfter cleanDist`, which is the other option that Gradle suggests -- it doesn't make sense IMO to clean after building the jar, after all.
 
Thank you, everyone, and if you're happy discussing this as a point of interest please don't let me stop you, but I'm not particularly worried about running it as one combined command, provided I can get Mafia to run. As I say, my own understanding of how Gradle works is a bit limited!

So, I have a zsh script that runs every morning at 5am (for me…), that checks a Mafia process isn't already running, backs up my preferences, moods and combat scripts, then CDs to the KoLMafia folder, runs 'git pull origin main', then './gradlew clean' and './gradlew runshadow'. That now seems to work. This normally all happens in the background, and I emerge from my bed, and lo—Mafia awaits!

There might well be a better way. Thanks for the help!
 
Top