gemini-code-assist[bot] commented on code in PR #39055:
URL: https://github.com/apache/beam/pull/39055#discussion_r3451128315


##########
sdks/java/testing/nexmark/build.gradle:
##########
@@ -99,6 +99,19 @@ if (isSparkRunner) {
   }
 }
 
+// Flink 2.1+ uses at.yawk.lz4:lz4-java instead of org.lz4:lz4-java
+// Explicitly prefer Flink's at.yawk.lz4 version to resolve capability conflict
+configurations.gradleRun {
+  resolutionStrategy.capabilitiesResolution.withCapability('org.lz4:lz4-java') 
{
+    def candidate = candidates.find { it.id.toString().contains('at.yawk.lz4') 
}
+    if (candidate != null) {
+      select(candidate)
+    } else {
+      selectHighestVersion()
+    }
+  }
+}

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Configuring the capability resolution strategy only on 
`configurations.gradleRun` might leave other configurations (such as 
`runtimeClasspath` or `testRuntimeClasspath`) vulnerable to the same capability 
conflict during other tasks (e.g., testing, compiling, or IDE sync). Applying 
this resolution strategy to `configurations.all` ensures consistent and robust 
dependency resolution across all configurations in this module.
   
   ```
   configurations.all {
     
resolutionStrategy.capabilitiesResolution.withCapability('org.lz4:lz4-java') {
       def candidate = candidates.find { 
it.id.toString().contains('at.yawk.lz4') }
       if (candidate != null) {
         select(candidate)
       } else {
         selectHighestVersion()
       }
     }
   }
   ```



-- 
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