protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.57k stars 15.48k forks source link

protoc can not generate java class #16437

Open baozi-2019 opened 6 months ago

baozi-2019 commented 6 months ago

protoc version: libprotoc 26.0

shell: protoc --plugin=protoc-gen-grpc-java=/protoc-gen-grpc-java-1.63.0-osx-aarch_64.exe --proto_path=/xx/proto --java_out=/xx/java paged.proto user.proto

mvn plugin: kr.motd.maven:protobuf-maven-plugin:1.7.1

When I use shell commands to generate Java classes, the blockinGrpcChannel class appears. I found that this class is no longer used, so I used the Maven plugin to generate the class again. However, when executing compile custom, it will overwrite the result of the compile command, resulting in the message not being generated. I don't know how to solve this problem, please help me.

paged.proto

syntax = "proto3";

option java_multiple_files=false;
option java_package="com.baozi.api";
option java_outer_classname="PagedRequest";
option go_package = "/internal/service/out";

package com.baozi.api;

message PagedRequestDTO {
  uint32 pageNum = 1;
  uint32 pageSize = 2;
}

user.proto

syntax = "proto3";

option java_multiple_files=false;
option java_package="com.baozi.api";
option java_outer_classname="UserServiceGrpc";

package com.baozi.api;

import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "paged.proto";

service UserService {
  rpc loginByPassword(LoginByPasswordReqDTO) returns(UserInfoWithPswOrAuthRespDTO);
    rpc queryUserByAccount(QueryUserByAccountReqDTO) returns(UserInfoWithPswOrAuthRespDTO);
    rpc getUserRolesAndPermissions(RolesAndPermissionsReqDTO) returns(RolesAndPermissionsRespDTO);
    rpc getUserAllInfoByUserId(GetUserAllInfoByUserIdReqDTO) returns(UserInfoWithPswOrAuthRespDTO);
    rpc getUserList(GetUserListReqDTO) returns(GetUserListRespDTO);
    rpc add(AddUserReqDTO) returns(AddUserRespDTO);
    rpc update(UpdateUserReqDTO) returns(UpdateUserRespDTO);
    rpc delete(DeleteUserReqDTO) returns(google.protobuf.Empty);
}

message LoginByPasswordReqDTO {
  string username = 1;
  bytes password = 2;
}

message QueryUserByAccountReqDTO {
  string account = 1;
  LoginAccountTypeEnum accountType = 2;
}

enum LoginAccountTypeEnum {
  USERNAME = 0;
  Phone = 1;
  EMAIL = 2;
}

message RolesAndPermissionsReqDTO {
  uint64 userId = 1;
}

message RolesAndPermissionsRespDTO {
  repeated string roles = 1;
  repeated string permissions = 2;
}

message UserInfoWithPswOrAuthRespDTO {
  uint64 userId = 1;
  string username = 2;
  string realName = 3;
  string phone = 4;
  string email = 5;
  uint32 sex = 6;
  string address = 7;
  google.protobuf.Timestamp createTime = 8;
  uint64 createUserId = 9;
  google.protobuf.Timestamp updateTime = 10;
  uint64 updateUserId = 11;
  oneof inner {
    AuthDTO auth = 12;
    PswDTO psw = 13;
  }
}

message AuthDTO {
  repeated string permissions = 12;
  repeated string roles = 13;
}
message PswDTO {
  bytes password = 4;
}

message GetUserAllInfoByUserIdReqDTO {
  uint64 userId = 1;
}

message GetUserListReqDTO {
    string username = 1;
    com.baozi.api.PagedRequestDTO page = 2;
}

message GetUserListRespDTO {
  repeated UserInfoWithPswOrAuthRespDTO userRespDTOs = 1;
  uint32 count = 2;
}

message AddUserReqDTO {
  uint64 userId = 1;
  string username = 2;
  string realName = 3;
  bytes password = 4;
  string phone = 5;
  string email = 6;
  google.protobuf.Timestamp createTime = 7;
  uint64 createUserId = 8;
}

message AddUserRespDTO {
  int32 resultCode = 1;
  repeated string repeatedParams = 2;
}

message UpdateUserReqDTO {
  uint64 userId = 1;
  string username = 2;
  string realName = 3;
  string password = 4;
  string phone = 5;
  string email = 6;
  uint64 updateUserId = 7;
}

message UpdateUserRespDTO {
  int32 resultCode = 1;
  repeated string repeatedParams = 2;
}

message DeleteUserReqDTO {
  uint64 userId = 1;
}
github-actions[bot] commented 3 months ago

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

JasonLunn commented 3 weeks ago

@baozi-2019 - is this issue still reproducible on the latest release?