Skip to content

Only configure protobuf gRPC generation for gRPC dependencies#50824

Closed
xfocus3 wants to merge 1 commit into
spring-projects:mainfrom
xfocus3:gh-50822-protobuf-without-grpc
Closed

Only configure protobuf gRPC generation for gRPC dependencies#50824
xfocus3 wants to merge 1 commit into
spring-projects:mainfrom
xfocus3:gh-50822-protobuf-without-grpc

Conversation

@xfocus3

@xfocus3 xfocus3 commented Jun 23, 2026

Copy link
Copy Markdown

Closes gh-50822

Spring Boot's Gradle plugin currently adds the protobuf grpc plugin to every generate proto task whenever the protobuf plugin is applied. In a protobuf-only build that has no gRPC dependencies, this makes generateProto try to resolve io.grpc:protoc-gen-grpc-java:null.

This updates the protobuf plugin reaction so the grpc plugin is only added to generate proto tasks when a gRPC dependency is declared. Protobuf-only builds still get the managed protoc artifact, while gRPC builds keep the existing @generated=omit configuration.

Verification:

  • ./gradlew --no-daemon :build-plugin:spring-boot-gradle-plugin:test --tests org.springframework.boot.gradle.plugin.ProtobufPluginActionIntegrationTests
  • ./gradlew --no-daemon :build-plugin:spring-boot-gradle-plugin:checkstyleMain :build-plugin:spring-boot-gradle-plugin:checkstyleTest
  • git diff --check HEAD^ HEAD

Signed-off-by: Ahmed El amraouiyine <amraouiyine@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 23, 2026
@wilkinsona

Copy link
Copy Markdown
Member

Thanks for the proposal. Resolving a configuration while configuring a task, even lazily, is to be avoided so we can't apply this fix.

@wilkinsona wilkinsona closed this Jun 23, 2026
@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.1.0 with protobuf plugin without grpc: Could not find io.grpc:protoc-gen-grpc-java:null

3 participants