Open xpe opened 10 years ago
To answer my question: the README should say to name the file as resources/proto/example.proto
.
If you read https://developers.google.com/protocol-buffers/docs/javatutorial you'll see that there are 3 names involved:
The .proto file starts with a package declaration, which helps to prevent naming conflicts between different projects. In Java, the package name is used as the Java package unless you have explicitly specified a java_package, as we have here. Even if you do provide a java_package, you should still define a normal package as well to avoid name collisions in the Protocol Buffers name space as well as in non-Java languages.
After the package declaration, you can see two options that are Java-specific: java_package and java_outer_classname. java_package specifies in what Java package name your generated classes should live. If you don't specify this explicitly, it simply matches the package name given by the package declaration, but these names usually aren't appropriate Java package names (since they usually don't start with a domain name). The java_outer_classname option defines the class name which should contain all of the classes in this file. If you don't give a java_outer_classname explicitly, it will be generated by converting the file name to camel case. For example, "my_proto.proto" would, by default, use "MyProto" as the outer class name.
I'm walking through the README example, but I get an error (see below).
I start a sample project with this
project.clj
:I create
resources/proto/person.proto
with these contents:Then I run
lein protobuf
and I get: