How Can I Get My Play! 2.0 Application to Automatically Compile Protocol Buffers?

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>/

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

  • Playframework 2 - Deploying to ec2
  • How do I make a Scala project “Import from git”able in Eclipse?
  • Building akka fails on “Error: could not retrieve JNA”
  • How to initialize a new Scala project in sbt, Eclipse and github
  • Organizing multiple scala interrelated sbt & git projects - best practice suggestions
  • Sbt project depending on a external & private github repository
  • What's recommended .gitignore for Scala/sbt project in IntelliJ IDEA?
  • Running a git command with wildcard works in bash but not through Process
  • One Solution collect form web for “How Can I Get My Play! 2.0 Application to Automatically Compile Protocol Buffers?”

    You can use sbt-protobuf. You will need to configure a few files as follows (using sbt 0.11 or greater):


    resolvers += "gseitz@github" at ""
    addSbtPlugin("com.github.gseitz" % "sbt-protobuf" % "0.2.2")


    // must be at top of file
    import sbtprotobuf.{ProtobufPlugin=>PB}
    seq(PB.protobufSettings: _*)
    javaSource in PB.protobufConfig <<= (sourceManaged in Compile)

    This configuration will expect protobufs in app/protobuf and 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.

    Git Baby is a git and github fan, let's start git clone.