yuqi1129 commented on code in PR #14997:
URL: https://github.com/apache/gravitino/pull/14997#discussion_r4597256941
##########
clients/client-java-runtime/build.gradle.kts:
##########
@@ -32,16 +32,25 @@ configurations.all {
}
}
+// Everything packaged into the shaded runtime jar. Declaring these as
`implementation` would make
+// Gradle publish them as `runtime` scoped POM dependencies and list them in
the Gradle module
+// metadata, so resolving the coordinate would download the modules and
third-party libraries the
+// jar already contains. See https://github.com/apache/gravitino/issues/13171
+val shadedDependencies by configurations.creating {
+ isCanBeConsumed = false
+ isCanBeResolved = true
+}
+
dependencies {
- implementation(project(":clients:client-java"))
+ shadedDependencies(project(":clients:client-java"))
Review Comment:
[Blocker] Moving these dependencies out of `implementation` leaves normal
Gradle consumers with only the empty JAR. This affects all eight runtime
modules.
The publication still uses `components["java"]`, and the regular `jar` still
has classifier `empty`. In the generated module metadata, `apiElements` and
`runtimeElements` point to `*-empty.jar`; only `shadowRuntimeElements` points
to the actual shaded JAR. A normal Gradle `implementation(...)` dependency
selects `runtimeElements` at runtime. Previously that variant brought in the
implementation through transitive dependencies; after this change it provides
neither the implementation classes nor those dependencies.
I reproduced this with an independent Gradle 8.2 consumer against a local
Maven-layout repository containing the generated POMs, module metadata, and
JARs. All eight coordinates selected their `*-empty.jar`. For the Java client:
```text
ARTIFACT: gravitino-client-java-runtime-2.0.0-SNAPSHOT-empty.jar
VARIANT: runtimeElements
MISSING: org.apache.gravitino.client.GravitinoClient
```
As a control, disabling Gradle module metadata and resolving only the POM
selected the actual shaded JAR and successfully loaded `GravitinoClient`.
Could we also adjust the publication/outgoing variants so ordinary Gradle
consumers receive the actual shaded artifact, and add a publication-consumer
regression test that checks both the absence of unwanted transitive
dependencies and the presence/loadability of an entry-point class? The new POM
check passes for the broken publication because it only checks dependency
declarations. All eight shaded builds and the existing 12 runtime tests passed
in my review; this was verified locally, without publishing to a remote
repository or launching an engine cluster.
--
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]