SkillAgentSearch skills...

Protobuf4j

Pure Java Protobuf tools

Install / Use

/learn @roastedroot/Protobuf4j
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

protobuf4j

protobuf4j is protobuf running as pure Java bytecode.

Why?

protoc is widely used by Java developers, unfortunately, invoking it and plugins requires native dependencies or relying on rewrites of the functionality. By compiling protobuf to Wasm and Wasm to Java bytecode thanks to Chicory we don't need to port the original source code and we have 1:1 functionality out-of-the-box.

Version Support

protobuf4j provides separate artifacts for different Protocol Buffers major versions:

| Group ID | Artifact | Protobuf Version | Use When | |----------|----------|------------------|----------| | io.roastedroot | protobuf4j-v3 | 3.25.x | Your app uses protobuf-java 3.x | | io.roastedroot | protobuf4j-v4 | 4.28.x | Your app uses protobuf-java 4.x |

Which version should I use?

  • Use the version that matches your application's protobuf-java dependency.
  • Most enterprise applications currently use v3.
  • v4 is the latest version but has breaking changes from v3. Consult the official protobuf repository for the full details.

Quick Start

For Protobuf 3.x Applications

Add protobuf4j-v3 as a Maven dependency:

<dependency>
    <groupId>io.roastedroot</groupId>
    <artifactId>protobuf4j-v3</artifactId>
    <version>0.0.1</version>
</dependency>

For Protobuf 4.x Applications

Add protobuf4j-v4 as a Maven dependency:

<dependency>
    <groupId>io.roastedroot</groupId>
    <artifactId>protobuf4j-v4</artifactId>
    <version>0.0.1</version>
</dependency>

Code Generation

| Plugin | Equivalent protoc flag | Output | |--------|--------------------------|--------| | JAVA | --java_out | Java message classes | | KOTLIN | --kotlin_out | Kotlin DSL wrappers around Java classes | | GRPC_JAVA | --grpc-java_out | Java gRPC service stubs |

Building the Project

To build this project, you'll need:

  • Docker (for building WASM modules)
  • JDK 11 or newer
  • Maven

Build Everything

Build both WASM modules and all Maven artifacts:

# Build WASM modules for both v3 and v4
make build

# Build and install Maven artifacts
mvn clean install

Build Individual Versions

Build only what you need:

# Build only v3
make build-v3
mvn install -am -pl core-v3

# Build only v4
make build-v4
mvn install -am -pl core-v4

Skip WASM Build

If you already have the WASM modules built:

# Just build/test Java code
mvn clean install

Project Structure

protobuf4j/
├── core-v3/          → protobuf4j-v3 artifact (Protobuf 3.25.x)
├── core-v4/          → protobuf4j-v4 artifact (Protobuf 4.28.x)
├── buildtools-v3/    → WASM build config for v3
├── buildtools-v4/    → WASM build config for v4
└── wasm/            → Compiled WASM modules

Acknowledgements

This project stands on the shoulders of giants:

Related Skills

View on GitHub
GitHub Stars30
CategoryDevelopment
Updated6d ago
Forks2

Languages

Java

Security Score

75/100

Audited on Mar 25, 2026

No findings