Fix/8976 modernize grpc gradle - #10344
Conversation
There was a problem hiding this comment.
Code Review
This pull request modernizes the Gradle build configuration across the api, client, and server subprojects by replacing the deprecated compile configuration with implementation, updating the application plugin configuration to use the application block, and updating the jar task to use runtimeClasspath. However, changing the gRPC dependencies in the api project to implementation will break compilation for the client and server projects, which transitively rely on those dependencies. It is recommended to use the api configuration instead, which also requires applying the java-library plugin.
| implementation "io.grpc:grpc-netty:${grpcVersion}" | ||
| implementation "io.grpc:grpc-protobuf:${grpcVersion}" | ||
| implementation "io.grpc:grpc-stub:${grpcVersion}" |
There was a problem hiding this comment.
Changing these dependencies to implementation will break the compilation of the client and server subprojects. Since client and server depend on project(':api') and directly reference gRPC classes (such as ManagedChannel, Server, StreamObserver, etc.), these dependencies must be exposed transitively on their compile classpaths.
To fix this, use the api configuration instead of implementation. Note that you will also need to change apply plugin: 'java' to apply plugin: 'java-library' at the top of this file (line 17) to make the api configuration available.
api "io.grpc:grpc-netty:${grpcVersion}"
api "io.grpc:grpc-protobuf:${grpcVersion}"
api "io.grpc:grpc-stub:${grpcVersion}"
Description
Fixes #
Checklist
Testing
mvn clean verifyrequiredmvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory onlyCompliance & Style
pom.xmlparent set to latestshared-configurationPost-Approval Actions