From 33586bf0270c5b32966bc6dc1cf4a745c61e0599 Mon Sep 17 00:00:00 2001 From: Kah Goh Date: Mon, 2 Feb 2026 19:13:27 +0800 Subject: [PATCH] Fix Gradle deprecated warning This fixes the following Gradle warning: ``` Deprecated Gradle features were used in this build, making it incompatible with Gradle 10. 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/9.1.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. ``` The exact error causing this: ``` > Configure project : Build file '/home/kah/workspace/exercism-java-representer/build.gradle': line 54 The archives configuration has been deprecated for artifact declaration. This will fail with an error in Gradle 10. Add artifacts as direct task dependencies of the 'assemble' task instead of declaring them in the archives configuration. Consult the upgrading guide for further information: https://docs.gradle.org/9.3.1/userguide/upgrading_version_9.html#sec:archives-configuration at build_65yhn6i09o9jce2intpqx5ncl$_run_closure6.doCall$original(/home/kah/workspace/exercism-java-representer/build.gradle:54) (Run with --stacktrace to get the full stack trace of this deprecation warning.) ``` --- build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3f3bfd1..fead983 100644 --- a/build.gradle +++ b/build.gradle @@ -45,13 +45,13 @@ jar { } } -shadowJar { +def representerJar = shadowJar { mergeServiceFiles() archiveFileName.set("java-representer.jar") } -artifacts { - archives shadowJar +tasks.named("assemble") { + dependsOn(representerJar) } test {