Jerkar library for Protobuf
This provides a library to use the protobuf compiler in your Java builds.
How to use
Protobuff compiler must be installed on the hosting machine.
Programmatically
You can use the protocol Buffer wrapper programmatically as a vanilla library using static method dev.jeka.plugins.protobuf.JkProtobufWrapper#compile
method.
Command line only
You can invoke this plugin from command line on a Jeka project without declaring it.
To compile .poto files jeka @dev.jeka.plugins:protobuf:[version] protobuf#compile
or jeka protobuf#compile
if you have annoted a def class with @JkDefClasspath
annotation.
To get help and options : jeka protobuf#help
Using with JkPluginJava
The most common usage is to use it along Jeka java
plugin. For such you only have to :
- declare the plugin as shown below
- update your IDE metadata
jeka intellij#iml
- that's all !
@JkDefClasspath("dev.jeka.plugins:protobuf:[version]")
public class Build extends JkCommandSet {
JkPluginJava javaPlugin = getPlugin(JkPluginJava.class);
JkPluginProtobuf protobufPlugin = getPlugin(JkPluginProtobuf.class);
...
}
The plugin takes care to :
- add a pre-compilation task for generating .java files in jeka/output/geneated_sources/java. .proto source files are supposed to lie in src/main/protobuf.
- append com.google.protobuf:protobuf-java library to project dependencies.
How to build this project
This project uses Jeka wrapper, you don't need to have Jeka installed on your machine. simply execute ./jekaw cleanPack
from the root of this project.