Importing protocol buffer definitions between Maven projects

后端 未结 2 1643
后悔当初
后悔当初 2021-02-02 17:26

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

2条回答
  •  甜味超标
    2021-02-02 18:02

    You can package your .proto files in a separate .jar/.zip in the project where they are generated, and publish them in your repository using a dedicated classifier. Using the assembly plugin might help here to publish something close to "source jars" that are built during releases.

    Then, on projects using them, add previously created artifact as dependency. Use the dependency plugin with the "unpack-dependencies" goal, and bind it to a phase before "compile".

提交回复
热议问题