Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc can not generate java class #16437

Open
baozi-2019 opened this issue Apr 6, 2024 · 0 comments
Open

protoc can not generate java class #16437

baozi-2019 opened this issue Apr 6, 2024 · 0 comments
Labels
untriaged auto added to all issues by default when created.

Comments

@baozi-2019
Copy link

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;
}
@baozi-2019 baozi-2019 added the untriaged auto added to all issues by default when created. label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged auto added to all issues by default when created.
Projects
None yet
Development

No branches or pull requests

1 participant