Using protobuf-maven-plugin for grpc-gateway

66 views
Skip to first unread message

ogd...@googlemail.com

unread,
Oct 11, 2017, 6:03:12 AM10/11/17
to grpc.io
Hello,

Is there a way to compile *.proto containing grpc-gateway definitions using maven? If so, what would that look like?

For regular gRPC services I do what the documentation says - compile using protobuf-maven-plugin with the grpc-java plugin. Much smoother than invoking ant or even running protoc from the command line. I would like to do the same for grpc-gateway.

<plugin>
    <groupId>org.xolstice.maven.plugins</groupId>
    <artifactId>protobuf-maven-plugin</artifactId>
    <version>0.5.0</version>
    <configuration>
        <!-- The version of protoc must match protobuf-java. 
                        If you don't depend on protobuf-java directly, you will be transitively depending 
                        on the protobuf-java version that grpc depends on. -->
        <protocArtifact>com.google.protobuf:protoc:${protobufVersion}:exe:${os.detected.classifier}</protocArtifact>
        <pluginId>grpc-java</pluginId>
        <pluginArtifact>io.grpc:protoc-gen-grpc-java:${gRpcVersion}:exe:${os.detected.classifier}</pluginArtifact>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>compile-custom</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Thank you,

David
Reply all
Reply to author
Forward
Message has been deleted
0 new messages