A powerful Java utility for generating Avro schemas and MapStruct mappers from Java DTO classes with minimal configuration.
- Automatic Schema Generation: Convert Java DTOs to Avro schemas with a single command
- Bidirectional Mapping: Generate MapStruct mappers for both DTO-to-Avro and Avro-to-DTO conversions
- Type Support: Handles complex types including:
- Nested objects and records
- Enums with custom values
- Collections (List, Set, Map)
- Java 8 Date/Time types (LocalDateTime, LocalDate)
- Custom type conversions
- Flexible Output: Choose between inline or standalone schema generation
- Smart Scanning: Automatic discovery of DTO classes with filtering options
- Build Tool Integration: Seamless integration with Maven and Gradle
- Java 17 or higher
- Maven 3.6.0+ or Gradle 7.0+
- Dependencies:
- Avro 1.11.x
- MapStruct 1.5.x
- Jackson 2.15.x
<dependency>
<groupId>com.example</groupId>
<artifactId>avro-mapstruct-generator</artifactId>
<version>1.0.0</version>
</dependency>implementation 'com.example:avro-mapstruct-generator:1.0.0'# Clone the repository
git clone https://github.com/yourusername/avro-mapstruct-generator.git
cd avro-mapstruct-generator
# Build the project
mvn clean install
# Generate schemas and mappers
java -jar target/avro-mapstruct-generator.jar \
--jar=path/to/your/dto-jar.jar \
--out=generated \
--packages=com.your.packagesrc/
├── main/java/codtumlr/utility/
│ ├── App.java # Main application entry point
│ ├── AvroSchemaGenerator.java # Avro schema generation logic
│ ├── MapperGenerator.java # MapStruct mapper generation
│ ├── ClassScanner.java # Classpath scanning utilities
└── test/ # Unit and integration tests
- Usage Guide - Detailed usage instructions and examples
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by Ravinderjeet Singh Nagpal