The problem
In the process of learning GRPC, two. Proto files are created, one is Memory and the other is GPU. The GPU needs to reference Menmoty
syntax = "proto3";
package proto;
option go_package = ". /; pd";
option java_multiple_files = true;
// Specify the build package name
option java_package = "com.zbc.proto";
// Specify the name of the generated class
option java_outer_classname = "Memory";
message Memory{
enum Unit{
UNKNOWN = 0;
BIT = 1;
BYTE = 2;
KILOBYTE = 3;
MEGABYTE = 4;
GIGABYTE = 5;
TERABYTE = 6;
}
uint64 value = 1;
Unit unit = 2;
}
Copy the code
syntax = "proto3";
package proto;
import "memory.proto";// This sentence is incorrect
option go_package = ". /; pd";
option java_multiple_files = true;
// Specify the build package name
option java_package = "com.zbc.test.proto";
// Specify the name of the generated class
option java_outer_classname = "Gpu";
message GPU {
string brand = 1;
string name = 2;
double min_ghz = 3;
double max_ghz = 4;
Memory memory = 5; // This sentence is incorrect
}
Copy the code
The problem
The solution
In this case, the proto file is not set. The folder where the proto file is stored is the source file.
Right-click on the folder where the.proto file is located and set the directory to the source root directory, as shown below:
This will be fine, but it may not take effect immediately and will require a restartIDEA