Skip to content

Fix/8976 modernize grpc gradle - #10344

Open
tejas5038 wants to merge 4 commits into
GoogleCloudPlatform:mainfrom
tejas5038:fix/8976-modernize-grpc-gradle
Open

Fix/8976 modernize grpc gradle#10344
tejas5038 wants to merge 4 commits into
GoogleCloudPlatform:mainfrom
tejas5038:fix/8976-modernize-grpc-gradle

Conversation

@tejas5038

Copy link
Copy Markdown

Description

Fixes #

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

Compliance & Style

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample

Post-Approval Actions

  • Please merge this PR for me once it is approved

@tejas5038
tejas5038 requested review from a team and yoshi-approver as code owners September 7, 2026 06:16
@product-auto-label product-auto-label Bot added samples Issues that are directly related to samples. api: endpoints Issues related to the Cloud Endpoints API. labels Sep 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +36 to +38
implementation "io.grpc:grpc-netty:${grpcVersion}"
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: endpoints Issues related to the Cloud Endpoints API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant