liveBook · Manning

Gradle plugin

As explained in Kafka Streams in Action, Second Edition

A Gradle plugin is an extension that adds project configuration, tasks, or integrations to the Gradle build system.

A Gradle plugin automates Schema Registry and serialization-platform work inside the Gradle build. It can run Registry actions and generate Java objects from Avro, Protobuf, and JSON Schema files. section 3.2.4 section 3.2.6

Use the appropriate plugin for each integration:

  • schema-registry-plugin interacts with Schema Registry, including compatibility testing, registration, and compatibility configuration. section 3.2.6
  • gradle-avro-plugin generates Java code from .avsc files, while protobuf-gradle-plugin generates Java code from .proto files. section 3.2.6
  • js2p-gradle generates Java code from JSON Schema files and requires explicit source and target-directory configuration. section 3.2.6 section 3.2.8

Schemas remain versioned source files, while generated domain objects reduce repetitive boilerplate and keep types aligned after schema changes. Avro and Protobuf use default schema directories; JSON Schema uses src/main/json when configured. section 3.2.6 section 3.2.8

Generate model objects

Run ./gradlew clean build to generate Java code for the project’s Avro, Protobuf, and JSON Schema types. The Protobuf plugin can use a Maven Central protoc artifact instead of a local compiler installation. section 3.2.8

How Kafka Streams in Action, Second Edition covers it

How deep it goes
Demonstrates plugin selection, schema locations, generated outputs, and protoc configuration, but does not detail plugin implementation internals.
Examples
Uses schema-registration tooling, src/main schema directories, build.gradle configuration, and the ./gradlew clean build command.
What it assumes
Assumes Gradle projects and schema files, while explaining plugin selection, schema directories, generated outputs, and protoc setup.
What you can do after
Apply it via Gradle to register schemas, test compatibility, configure Registry behavior, and generate Java domain objects.
How it connects
Connects Gradle with Schema Registry, Avro, Protobuf, JSON Schema, Java code generation, and protoc.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka Streams in Action, Second Edition. The section links point to the parts of the book it draws on.