xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
232 stars 76 forks source link

Multiple proto source roots #11

Closed gavinsherry closed 7 years ago

gavinsherry commented 7 years ago

I would like to include multiple source root directories as targets for the plugin. Reviewing the documentation and source code this is not currently possible. Is it a feature you'd consider adding?

-Gavin

sergei-ivanov commented 7 years ago

Can you please explain your use case in a little more detail? If I understand it correctly, declaring multiple executions of the plugin might help you achieve your goal. Alternatively, you may choose to break the project down into a number of modules (note that protobuf imports work well across multiple modules).

gavinsherry commented 7 years ago

Hi @sergei-ivanov. Thanks for your response.

I am including protobufs via a git submodule. I also have local protobufs. My goal is to have the plugin compile all of the protobufs without creating multiple modules.

sergei-ivanov commented 7 years ago

Hi Gavin,

Again, a little more information would be beneficial. If it is a public project, a link would be great. Are your local protobufs dependent on the ones from the submodule? What are you trying to do is not really the Maven way (more like a Gradle way), but I still think you can achieve your goal using the existing means. For example, one execution to compile the protos in the submodule into a separate output directory, another execution with submodule proto directory added to additionalProtoPaths to compile the local protobufs.

Sergei

gavinsherry commented 7 years ago

Hi again,

Unfortunately this is not a public project.

I suspected that this was not really a Maven way of doing things :). Unfortunately I'm somewhat stuck with it for the moment.

The approach you outlined should work, particularly with the help of additionalProtoPaths since there is a dependency from the local protobufs on the submodule protobufs.

Thanks for your help! I'm closing this issue now.