jProtoc makes it easy to create protoc plugins that execute in jar files, which can be easily referenced by the maven-protobuf-plugin. Unfortunately, other build toolchains like Gradle don't have this capability. Additionally, the requirement that Java plugins be executed as java -jar xxx limits their cross toolchain applicability. The existing work-around is to package jProtoc plugins with shell scripts, but this limits their usability across platforms - notably, Windows.
Canteen aims to solve this problem by enabling cross-platform self-executing jar files, which can be executed natively on Mac, Linux, and Windows directly from the command line.
How does this work?
Jar files are really zip files
Zip files keep their index table at the end of the file, with offsets computed backwards from the last byte
You can prepend a zip file with arbitrary bytes without affecting the integrity of the archive
Those arbitrary bytes can be a compiled executable, which shells out to java -jar
jProtoc makes it easy to create protoc plugins that execute in jar files, which can be easily referenced by the
maven-protobuf-plugin
. Unfortunately, other build toolchains like Gradle don't have this capability. Additionally, the requirement that Java plugins be executed asjava -jar xxx
limits their cross toolchain applicability. The existing work-around is to package jProtoc plugins with shell scripts, but this limits their usability across platforms - notably, Windows.Canteen aims to solve this problem by enabling cross-platform self-executing jar files, which can be executed natively on Mac, Linux, and Windows directly from the command line.
How does this work?
java -jar