Closed shuigedeng closed 1 year ago
There is nothing we can do there. Please ask this question in the protobuf repo and link it here.
There is already a lengthy discussion in https://github.com/grpc/grpc-java/issues/9179 on replacing javax.annotation.Generated
. As a workaround, try adding javax.annotation:javax.annotation-api
to your dependencies.
springboot: 3.0.4 gradle: 8.0.1 jdk: 17
配置文件如下: apply plugin: "com.google.protobuf" dependencies { api "io.grpc:grpc-netty:1.53.0" api "io.grpc:grpc-protobuf:1.53.0" api "io.grpc:grpc-stub:1.53.0" api "io.grpc:grpc-services:1.53.0" api "io.grpc:grpc-api:1.53.0" api "io.grpc:grpc-context:1.53.0" api "io.grpc:grpc-core:1.53.0" api "io.netty:netty-common:4.1.89.Final"
}
protobuf { //指定protoc编译器位置 在 protoc 模块下,可以指定多个配置,但是会以最后一个配置为准。 protoc { //直接使用Maven Central上已经编译好的protoc编译器, artifact = "com.google.protobuf:protoc:3.19.1" //指定本地已经安装的protoc编译器 //path = '/usr/local/bin/protoc' } //generatedFilesBaseDir = "$projectDir/src/generated" clean { delete generatedFilesBaseDir } //指定protoc运行插件 plugins { grpc { artifact = "io.grpc:protoc-gen-grpc-java:1.53.0" } //javalite { // // The codegen for lite comes as a separate artifact // artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.1' //} } generateProtoTasks { all()*.plugins { grpc {} } } }
最终生成的结果: @javax.annotation.Generated( value = "by gRPC proto compiler (version 1.53.0)", comments = "Source: Test.proto") @io.grpc.stub.annotations.GrpcGenerated
请问一下怎么才生成 @jakarta.annotation.Generated 呢