Skip to content

Conversation

@ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Nov 24, 2025

Motivation:

':core:shadedClasses' fails when JaCoCo report is enabled by -Pcoverage because shadedClasses is only used in the JaCoco task.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:shadedClasses'.
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:135)
  at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:288)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:133)
  ...
  at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
  at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: org.gradle.api.InvalidUserDataException: Cannot expand ZIP '/home/runner/work/armeria/armeria/core/build/libs/armeria-1.33.3-SNAPSHOT-shaded.jar' as it does not exist.

return a + [b.tasks.shadedClasses.destinationDir]

It seems that the archiveClassifier.set('shaded') configuration used when upgrading Gradle 9 is causing the problem.
Based on the following two configurations, the path of archiveFile becomes <artifact>-untrimmed-<version>-shaded.jar.

archiveClassifier.set('shaded')
tasks.shadedJar.archiveBaseName.set("${tasks.jar.archiveBaseName.get()}-untrimmed")

This is then renamed to <artifact>-shaded-<version>-shaded.jar by trimShadedJar task. However, since the input file of shadedClasses is <artifact>-<version>-shaded.jar, the task fails to fine the jar file.

Modifications:

  • Generate the output file name correctly by removing untrimmed infix from the output jar file instead of renaming it to shaded.
  • Miscellaneous) Make publishJarPublicationToMavenLocal depend on shadedTask or trimShadedJar to run publishToMavenLocal successfully.

Result:

:core:shadedClasses runs correctly

Summary by CodeRabbit

  • Chores
    • Updated build artifact naming conventions to improve clarity and consistency in generated outputs.

✏️ Tip: You can customize this high-level summary in your review settings.

Motivation:

':core:shadedClasses' fails when JaCoCo report is enabled by
`-Pcoverage`.
```java
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:shadedClasses'.
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:135)
  at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:288)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:133)
  ...
  at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
  at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: org.gradle.api.InvalidUserDataException: Cannot expand ZIP '/home/runner/work/armeria/armeria/core/build/libs/armeria-1.33.3-SNAPSHOT-shaded.jar' as it does not exist.
```

It is difficult to analyze why the test fails when JaCoCo is enabled,
but it seems the `archiveClassifier.set('shaded')` configuration used when
upgrading Gradle 9 is causing the problem.
Based on the following two configurations, the path of archiveFile
becomes `<artifact>-untrimmed-<version>-shaded.jar`.
https://github.com/line/armeria/blob/7148df07f3a7fe7cb4640fb1ca761cbaca8b347f/gradle/scripts/lib/java-shade.gradle#L28
https://github.com/line/armeria/blob/7148df07f3a7fe7cb4640fb1ca761cbaca8b347f/gradle/scripts/lib/java-shade.gradle#L118

This is then renamed to `<artifact>-shaded-<version>-shaded.jar` by
`trimShadedJar` task. However, since the input file of `shadedClasses` is
`<artifact>-<version>-shaded.jar`, the task fails to fine the jar file.

Modifications:

- Generate the output file name correctly by removing `untrimmed` infix
  from the output jar file instead of renaming it to `shaded`.

Result:

`:core:shadedClasses` runs correctly
@ikhoon ikhoon added this to the 1.34.0 milestone Nov 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 24, 2025

Walkthrough

Two Gradle scripts were updated: the shaded JAR filename calculation in gradle/scripts/lib/java-shade.gradle was modified to remove the "-untrimmed" segment for final shaded artifacts, and gradle/scripts/lib/java-publish.gradle now ensures the local publish task depends on the shaded-jar task when present.

Changes

Cohort / File(s) Summary
Shaded JAR naming
gradle/scripts/lib/java-shade.gradle
Comment updated to document new target name format; changed the renaming logic so the final shaded JAR name omits the "-untrimmed" segment (resulting in "--shaded.jar") instead of replacing "-untrimmed-" with "-shaded-".
Publish task dependency
gradle/scripts/lib/java-publish.gradle
Added defensive wiring so publishJarPublicationToMavenLocal depends on the appropriate shaded jar task (e.g., trimShadedJar or shadedJar) where present; applied in both the publish/java block and the broader publish configuration.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer/Gradle
  participant Pub as publishJarPublicationToMavenLocal
  participant Shade as shadedJarTask
  participant Repo as mavenLocal

  Note over Dev,Pub: New dependency wiring added
  Dev->>Pub: run publish to mavenLocal
  alt shaded jar task exists
    Pub->>Shade: dependsOn (ensure shaded artifact built)
    Shade-->>Pub: produces shaded JAR
  end
  Pub->>Repo: upload artifact (shaded or normal)
  Repo-->>Pub: publish complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review java-shade.gradle rename logic and comment to ensure final filename matches intended downstream expectations.
  • Verify java-publish.gradle correctly locates the shaded task in both places and doesn't introduce task-graph ordering issues.
  • Check cross-references in CI or release scripts that might rely on the previous filename pattern.

Poem

🐰 A little tweak in build-time light,
The shaded jar hops into sight.
No "-untrimmed" to slow the race,
Publish waits in tidy grace—
Bunny cheers for names just right! 🎁🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title directly addresses the main issue being fixed: the :core:shadedClasses failure. It accurately captures the primary change objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.18%. Comparing base (8150425) to head (52321aa).
⚠️ Report is 246 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6514      +/-   ##
============================================
- Coverage     74.46%   74.18%   -0.29%     
- Complexity    22234    23273    +1039     
============================================
  Files          1963     2089     +126     
  Lines         82437    86975    +4538     
  Branches      10764    11433     +669     
============================================
+ Hits          61385    64519    +3134     
- Misses        15918    17002    +1084     
- Partials       5134     5454     +320     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-checked that the actual publish doesn't depend on the trimmed jar's name

@ikhoon ikhoon merged commit 2bcdb85 into line:main Nov 25, 2025
16 of 17 checks passed
@ikhoon ikhoon deleted the fix-shadedClasses branch November 25, 2025 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants