title: Importing "google/protobuf/descriptor.proto" in java protocol buffers
body: <p>I have a <code>.proto</code> file definition which needs to import <code>&quot;google/protobuf/descriptor.proto&quot;</code> because I use <a href="https://developers.google.com/protocol-buffers/docs/proto?hl=cs" rel="nofollow noreferrer">Custom Options</a>.</p>
  <p>So in my <code>.proto</code> file I do:</p>
  <pre><code>import &quot;google/protobuf/descriptor.proto&quot;;
  package ...;
  
  ...
  </code></pre>
  <p>Since my file didn't compile complaining about the dependency, I got a copy of the descriptor.proto file placing it in the same directory my proto file was.</p>
  <p>This solved the problem but I don't believe this is the correct way. Now the <code>descriptor.proto</code> gets compiled together with my <code>.proto</code> file resulting in having 2 compiled <code>descriptor.proto</code> at runtime:</p>
  <ul>
  <li>the one shipped with the <code>protobuf-java-2.5.0.jar</code> file</li>
  <li>the one which was compiled together with my <code>.proto</code> file</li>
  </ul>
  <p>I think the <code>--proto-path</code> option should be used somehow but not entirely sure what is the correct way.</p>
  <p>Thanks for the best practise tip here!</p>