I currently manage a few separate Maven projects in which I use Protobufs as a serialization format and over the wire. I am using David Trott\'s maven-protoc plugin to generate
I've found another way to achieve, and it doesn't involve any Maven magic. Diving into the code for the maven-protoc plugin, I found that this is a supported use case -- the plugin will look for and collect and .proto files in dependent jars and unpack them into a temporary directory. That directory is then set as an import path to the protoc invocation.
All that needs to happen is for the .proto file to be included in the dependency's package, which I did by making it a resource:
projects/a/src/main/resources/a.proto
Now in projects/b/pom.xml, add 'a' as a regular Maven dependency and just import a.proto from b.proto as if it existed locally:
b.proto: import "a.proto";
This isn't ideal, since files names may clash between various projects, but this should occur rarely enough.