Generate code files with a. proto file when using protocol buffer times wrong
Using commands
Protoc.exe--java_out C:\logs\ User.proto
User.proto file content format is as follows
Message user{ require D string userName = 1[default= ""]; & nbsp; Required String password = 2[ default= ""]; } The following error occurred while using the cmd command
--java_out:user.proto:user.proto:cannot generate Java output because the file
' s outer class name, ' User ', matches the name of the one of the types declared Insid
E it. Either rename the type or use the Java_outer_classname option to s
Pecify a different outer class name for the. Proto file.
Workaround:
Cause User.proto file name and the class name inside duplicate, the file name is user inside the content message user uses user
Modify the User.proto file name to not and the inside of the class name is repeated, it is changed to Userprotobuff
Then run Protoc.exe--java_out c:\logs\ Userprotobuff.proto run successfully.
Second workaround:
Add an I line to the Ptoto file
Option java_outer_classname="Reservationtypeouterclass";
To specify the class name of the generated Java class
[Fix]--java_out:user.proto:user.proto:cannot generate Java output because the file ' s