Stubs
Java SDKs

Generate a Java library from Protobuf

Push your .proto files to Stubs and install the generated Java code with Gradle or Maven, versioned with every commit. No protoc, no plugins to install and no generated code to commit.

Try it now

Install one in a minute

This is the Java SDK of stubs/petstore, a public demo module: a small pet store's API. Install it with Gradle or Maven in an empty project. You don't need an account.

Install it

Add the repository and the dependencybuild.gradle.kts
repositories {
    maven { url = uri("https://maven.stubs.dev/") }
    mavenCentral()
}

dependencies {
    implementation("dev.stubs.gen:stubs_petstore_protobuf-java:36.2-20261128015706-2ff545c5db11.4")
}
Add the repository and the dependencypom.xml
<repositories>
  <repository>
    <id>stubsdev</id>
    <url>https://maven.stubs.dev/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>dev.stubs.gen</groupId>
    <artifactId>stubs_petstore_protobuf-java</artifactId>
    <version>36.2-20261128015706-2ff545c5db11.4</version>
  </dependency>
</dependencies>
Main.java
import dev.stubs.gen.petstore.v1.Pet;
import dev.stubs.gen.petstore.v1.Species;

public class Main {
    public static void main(String[] args) {
        Pet pet = Pet.newBuilder().setName("Rex").setSpecies(Species.SPECIES_DOG).addTags("house-trained").build();
        System.out.println(pet);
    }
}
Output
name: "Rex"
species: SPECIES_DOG
tags: "house-trained"

With your own schemas

From stubs push to Gradle or Maven

  1. 01

    Sign in from the CLI

    Install the stubs CLI and sign in to stubs.dev. The buf CLI works too, with your buf.yaml as it is.

    $ stubs login stubs.dev
  2. 02

    Push your module

    Each push is an immutable commit of your .proto files, linted and checked for breaking changes.

    $ stubs push
  3. 03

    Install it with Gradle or Maven

    The package is built from that commit the first time it's asked for. The module's SDKs tab has the exact version.

    $ implementation("dev.stubs.gen:acme_payments_protobuf-java:<version>")

The Java SDK docs cover private modules and versions. Already using buf? Your projects work as they are.

What you get

Packages, not generated files

Try Stubs with your own schemas

Create an account, push a module and install your first generated SDK in a few minutes.