Fix lazy shadowJar wiring in root build #3

Merged
NotAlexNoyle merged 1 commits from codex/fix-gradle-build-error-for-shadowjar into master 2026-03-23 07:05:44 -04:00
NotAlexNoyle commented 2026-03-23 07:05:35 -04:00 (Migrated from github.com)

Motivation

  • The root build eagerly resolved :eternalcombat-plugin's shadowJar task during configuration which caused a "Task with name 'shadowJar' not found" failure when the subproject had not yet created the task.

Description

  • Replace the eager project(":eternalcombat-plugin").tasks.named("shadowJar") usage with a lazy wiring that uses project(":eternalcombat-plugin"), declares dependsOn(":eternalcombat-plugin:shadowJar"), and copies the produced JAR from the plugin project's build/libs via pluginProject.provider { pluginProject.layout.buildDirectory.file("libs/EternalCombat-${pluginProject.version}.jar").get().asFile } so the artifact is resolved at execution time.

Testing

  • Ran ./gradlew clean build eclipse --warning-mode all, which no longer fails during early shadowJar lookup but is now blocked later by the environment lacking a Java 17 toolchain required by the project; this demonstrates the original error is fixed.
  • Ran java -version and ./gradlew -version to inspect the environment and Gradle launcher, both commands executed successfully.

Codex Task

### Motivation - The root build eagerly resolved `:eternalcombat-plugin`'s `shadowJar` task during configuration which caused a "Task with name 'shadowJar' not found" failure when the subproject had not yet created the task. ### Description - Replace the eager `project(":eternalcombat-plugin").tasks.named("shadowJar")` usage with a lazy wiring that uses `project(":eternalcombat-plugin")`, declares `dependsOn(":eternalcombat-plugin:shadowJar")`, and copies the produced JAR from the plugin project's `build/libs` via `pluginProject.provider { pluginProject.layout.buildDirectory.file("libs/EternalCombat-${pluginProject.version}.jar").get().asFile }` so the artifact is resolved at execution time. ### Testing - Ran `./gradlew clean build eclipse --warning-mode all`, which no longer fails during early `shadowJar` lookup but is now blocked later by the environment lacking a Java 17 toolchain required by the project; this demonstrates the original error is fixed. - Ran `java -version` and `./gradlew -version` to inspect the environment and Gradle launcher, both commands executed successfully. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69c11d91936c832f947f82d8b8dcf710)
Sign in to join this conversation.