title: Using grpc in maven
body: <p>Does anyone know how to compile *.proto files for grpc application in maven?</p>
  
  <p>This is how I'm compiling protobuf in maven - (old way, using installed protoc compiler, excerpt from pom.xml):</p>
  
  <pre><code>  &lt;build&gt;
      &lt;plugins&gt;
  
        &lt;!-- protocol buffers runner, requires protoc --&gt;
        &lt;plugin&gt;
          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
          &lt;executions&gt;
            &lt;execution&gt;
              &lt;id&gt;generate-protobuf-sources&lt;/id&gt;
              &lt;phase&gt;generate-sources&lt;/phase&gt;
              &lt;configuration&gt;
                &lt;tasks&gt;
                  &lt;mkdir dir="target/generated-sources/java" /&gt;
  
                  &lt;exec executable="protoc"&gt;
                    &lt;arg value="--java_out=target/generated-sources/java" /&gt;
                    &lt;arg value="src/main/protobuf/hello.proto" /&gt;
                  &lt;/exec&gt;
                &lt;/tasks&gt;
                &lt;sourceRoot&gt;target/generated-sources/java&lt;/sourceRoot&gt;
              &lt;/configuration&gt;
              &lt;goals&gt;
                &lt;goal&gt;run&lt;/goal&gt;
              &lt;/goals&gt;
            &lt;/execution&gt;
          &lt;/executions&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/build&gt;
  </code></pre>
  
  <p>I wonder if something similar is possible for grpc. From what I understand I need to somehow connect protoc-gen-grpc-java plugin with protobuf, but I'm not sure how to do that.</p>
  
  <p>UPDATE: For those who interested I created a fully working example of client-server app using maven <a href="https://github.com/avshabanov/examples/tree/master/src/rpc/hello-grpc" rel="noreferrer">on github</a>.</p>