// The standard protobuf block, same as normal gRPC Java projects protobuf { // The artifact spec for the Protobuf Compiler protoc { artifact = 'com.google.protobuf:protoc:3.19.4' } // Optional: an artifact spec for a protoc plugin, with "grpc" as // the identifier, which can be referred to in the "plugins" // container of the "generateProtoTasks" closure. plugins { grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.45.0" } grpckt { artifact = "io.grpc:protoc-gen-grpc-kotlin:1.2.1:jdk7@jar" } } generateProtoTasks { all()*.plugins { // 没有这句,不生成 message.java java {} // 没有这句,不生成 message.kt kotlin {} // 没有这句,不生成 grpc.java grpc {} // 没有这句,不生成 grpc.kt grpckt {} } } }