I have a few .proto files for my project that I used the generated Java source for. I would like Play to automatically compile and include these files during project compilation.
Ideally, I would keep my .proto files within the app directory as follows:
<play root>/
app/
protobuf/
myfile.proto
controllers/
Application.scala
...
A few requirements are as follows:
- The generated source should not be included in git
- Heroku must be able to compile the protobufs during deployment
You can use sbt-protobuf. You will need to configure a few files as follows (using sbt 0.11 or greater):
project/plugins.sbt
build.sbt
This configuration will expect protobufs in
app/protobufand place them in the managed (not version controlled) source directory.Warning – Do not give your protobuf files the package name
messages, it will interfere with Play and you will get i18n errors all over the place.