Protobuffs import from another directory
As the error message states, the file you pass on the command line needs to be in one of the --proto_path
s. In your case, you have only specified one --proto_path
of:
/home/project_new1/
But the file you're passing is:
/home/project_new1/settings/UserOptions.proto
Notice that the file is not in the account
subdirectory; it's in settings
instead.
You have two options:
- (Not recommended) Pass a second
--proto_path
argument to add.../settings
to the path. (Recommended) Use the root of your source tree as the proto path. E.g.:
protoc --proto_path=/home/project_new1/ --java_out=/home/project_new1 /home/project_new1/settings/UserOptions.proto
In this case, to import Account.proto
, you'll need to write:
import "account/Account.proto";