maven 2 - Integrate Protocol Buffers into Maven2 build -
I am experimenting with protocol buffers in an existing, substantial Vanilla Maven 2 project. Currently, whenever I invoke a shell script every time I update my generated sources it is clearly a problem because I want to automatically generate the source before each build. Hope without shameful rage
So, my question is two times:
-
Long shot: A "protocol buffer plugin" for Maven 2 that achieves the above in an automagic way Can you? There is such a writer who took a shot after applying such a plugin. Unfortunately, it has been merged into protobe trunk or. The status of this plugin is thus unknown.
-
Perhaps more realistic: the lack of a real plugin, how would I go about applying
protoc
to my maven? 2 build? I think I might be able to wire my existing shell script into anantrun
orientation or something similar.
Personal experiences are most appreciated.
You will find some information about the plug-in available in the protocol buffers repository in the thread on the protocol buffer. . My understanding is that it is usable but there is a lack of tests. I give it a try.
Or you can simply use the Enter
plugin (snippet to paste from the thread mentioned above):
& lt; Build & gt; & Lt; Plugins & gt; & Lt; Plugin & gt; & Lt; ArtifactId & gt; Maven-antrun-plugin & lt; / ArtifactId> & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; ID & gt; Generating sources & lt; / Id & gt; & Lt; Step & gt; Generating sources & lt; / Step & gt; & Lt; Configuration & gt; & Lt; Functions & gt; & Lt; Mkdir dir = "target / generated-sources" / & gt; & Lt; Exec Executable = "Protocol" & gt; & Lt; Arg value = "- java_out = target / generated-sources" /> & Lt; Arg value = "src / main / protobuf / test.proto" /> & Lt; / Executive & gt; & Lt; / Functions & gt; & Lt; SourceRoot & gt; Goals / Generating-sources & lt; / SourceRoot & gt; & Lt; / Configuration & gt; & Lt; Goals & gt; & Lt; Goal & gt; Run & lt; / Target & gt; & Lt; / Targets & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; / Plugin & gt; & Lt; / Plugins & gt; & Lt; / Create & gt; & Lt; Dependency & gt; & Lt; Dependency & gt; & Lt; Group & gt; Com.google.protobuf & lt; / Group & gt; & Lt; ArtifactId & gt; Protobuf-Java & lt; / ArtifactId> & Lt; Version & gt; 2.0.3 & lt; / Version & gt; & Lt; / Dependencies & gt; & Lt; / Dependencies & gt;
Comments
Post a Comment