yuqi1129 opened a new issue, #11164:
URL: https://github.com/apache/gravitino/issues/11164

   ### What would you like to be improved?
   
   `./gradlew compileDistribution` (`build.gradle.kts:781`) is a copy-only task 
— it depends on a list of `copy*` subtasks and a `doLast` block that copies 
`conf/`, `bin/`, etc. into `distribution/package/`, but it never **removes** 
files that are no longer produced by the build. Old jars from previous versions 
silently accumulate.
   
   Concrete example hit on 2026-05-20 while validating the `lance-core` 4.0.1 → 
6.0.0 upgrade:
   - `distribution/package/libs/` ended up with **both** `lance-core-4.0.1.jar` 
and `lance-core-6.0.0.jar`.
   - `distribution/package/lance-rest-server/libs/` had the same duplicate.
   - `distribution/package/libs/lance-namespace-apache-client-0.5.2.jar` from a 
much older build was still present, shadowing the newer `0.7.5` that the aux 
service expected. This silently broke the `lance-ray` matrix integration test 
for **days** (request schema validation rejected `check_declared`, see #10983).
   
   Because Java classpath order is undefined when two versions of the same jar 
are present, the bug surfaces non-deterministically — passes in CI (always 
fresh checkout) and fails locally after any version bump.
   
   ### How should we improve?
   
   Make `compileDistribution` start from a clean output directory. Two options, 
pick one:
   
   1. **(preferred — narrow)** In the `compileDistribution` task block, add a 
`doFirst { delete(projectDir.dir("distribution/package")) }` so only the 
distribution output is wiped (not other modules' `build/`). Cheap and 
self-contained.
   2. **(alternative)** Register a small task like `cleanDistributionPackage` 
that deletes `distribution/package/`, then add 
`dependsOn(cleanDistributionPackage)` and make sure it runs before the `copy*` 
tasks (e.g. via `mustRunAfter`).
   
   A repo-wide `./gradlew clean` would also fix it but forces a full Java 
rebuild — too heavy as a default.
   
   Verify with:
   ```bash
   ./gradlew clean compileDistribution -PskipWeb=true -x test
   # bump a version in gradle/libs.versions.toml, then:
   ./gradlew compileDistribution -PskipWeb=true -x test
   # ls distribution/package/libs/ | grep <old-version>   # should be empty
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to