Skip to content

Provide protobuf gradle plugin support #49369

@philwebb

Description

@philwebb

We need something like #49353 for Gradle, probably our plugin reacting the protobuf plugin. The current start.spring.io generated config is:

Project
plugins {
  id 'java'
  id 'org.springframework.boot' version '4.0.4-SNAPSHOT'
  id 'io.spring.dependency-management' version '1.1.7'
  id 'com.google.protobuf' version '0.9.5'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
description = 'Demo project for Spring Boot'

java {
  toolchain {
    languageVersion = JavaLanguageVersion.of(25)
  }
}

repositories {
  mavenCentral()
  maven { url = 'https://repo.spring.io/snapshot' }
}

ext {
  set('springGrpcVersion', "1.0.2")
}

dependencies {
  implementation 'io.grpc:grpc-services'
  implementation 'org.springframework.grpc:spring-grpc-spring-boot-starter'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
  testImplementation 'org.springframework.grpc:spring-grpc-test'
  testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

dependencyManagement {
  imports {
    mavenBom "org.springframework.grpc:spring-grpc-dependencies:${springGrpcVersion}"
  }
}

protobuf {
  protoc {
    artifact = 'com.google.protobuf:protoc'
  }
  plugins {
    grpc {
      artifact = 'io.grpc:protoc-gen-grpc-java'
    }
  }
  generateProtoTasks {
    all()*.plugins {
      grpc {
        option '@generated=omit'
      }
    }
  }
}

tasks.named('test') {
  useJUnitPlatform()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: team-onlyAn issue that's best handled directly by the team rather than a community contribution.type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions