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
