On Mon, 10 Mar 2014 09:22:03 -0700 (PDT) Stik kos <[email protected]> wrote:
> Hello, > > We have defined a bunch of common messages (like Country, Currency, > Money, ...) and packaged them in a JAR together with the generated > (and compiled) JAVA classes. We would then like to have multiple > projects include this JAR as a dependency. > Is it possible to import a .proto file directly from a JAR? > And is it possible to not generate JAVA files for these common > messages but use the once in the common JAR in stead? > > Thanks, > Stik > You shouldn’t need the .proto files at all in order to *use* the messages from other applications; that’s what the generated language source files are for. Java being what it is, you should just be able to use the .class files from your .jar without including either the .proto or .java files at all, just like you would use .class files in any other .jar-based library you use in your system: arrange for the .jar to be in your classpath, like you would do with any other library .jar, and then consume the appropriate classes in your own code, like you would with any other library. -- Christopher Head
signature.asc
Description: PGP signature
