11<p align =" center " >
22 <a href =" https://github.com/AkaZver/mapstruct-plugin/actions " ><img src =" https://github.com/AkaZver/mapstruct-plugin/workflows/Build/badge.svg " alt =" Actions Status " ></a >
3+ <a href =" # " ><img src =" https://img.shields.io/gradle-plugin-portal/v/com.github.akazver.mapstruct?label=Plugin Version&logo=github " alt =" Plugin Version " ></a >
34 <a href =" https://sonarcloud.io " ><img src =" https://sonarcloud.io/api/project_badges/measure?project=AkaZver_mapstruct-plugin&metric=alert_status " alt =" Quality Gate Status " ></a >
45 <a href =" https://sonarcloud.io " ><img src =" https://sonarcloud.io/api/project_badges/measure?project=AkaZver_mapstruct-plugin&metric=coverage " alt =" Coverage " ></a >
56 <br />
1819
1920Gradle plugin for easy [ MapStruct] ( https://mapstruct.org/ ) setup
2021
21- Usage:
22+ ## Requirements
23+
24+ - ** Gradle:** 9.0 or higher
25+ - ** Java:** 17 or higher
26+
27+ ## Usage
28+
2229``` groovy
2330plugins {
24- id 'com.github.akazver.mapstruct' version '2.0.0 '
31+ id 'com.github.akazver.mapstruct' version 'X.Y.Z '
2532}
2633```
2734
28- ## Dependencies
29- ** MapStruct** (required)
30- - [ mapstruct] ( https://mvnrepository.com/artifact/org.mapstruct/mapstruct ) (implementation)
31- - [ mapstruct-processor] ( https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor ) (annotationProcessor)
35+ ## How it works
3236
33- ** Lombok** (optional)
34- - [ lombok-mapstruct-binding] ( https://mvnrepository.com/artifact/org.projectlombok/lombok-mapstruct-binding ) (annotationProcessor)
37+ The plugin automatically:
3538
36- ** Spring** (optional)
37- - [ mapstruct-spring-annotations] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-annotations ) (implementation)
38- - [ mapstruct-spring-extensions] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-extensions ) (annotationProcessor)
39- - [ mapstruct-spring-test-extensions] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-test-extensions ) (testImplementation)
39+ - Adds MapStruct dependencies (` mapstruct ` and ` mapstruct-processor ` )
40+ - Detects optional dependencies (Lombok, Spring, Camel, Quarkus, Protobuf) in your project
41+ - Adds required binding libraries when needed (e.g., ` lombok-mapstruct-binding ` for Lombok)
42+ - Configures compiler arguments based on your ` mapstruct {} ` block settings
43+ - Runs after project evaluation to ensure all dependencies are resolved
4044
41- ** Camel** (optional)
42- - [ camel-mapstruct] ( https://mvnrepository.com/artifact/org.apache.camel/camel-mapstruct ) (implementation)
43- - [ camel-mapstruct-starter] ( https://mvnrepository.com/artifact/org.apache.camel.springboot/camel-mapstruct-starter ) (implementation)
44- - [ camel-quarkus-mapstruct] ( https://mvnrepository.com/artifact/org.apache.camel.quarkus/camel-quarkus-mapstruct ) (implementation)
45+ ## Dependencies
46+
47+ | Category | GitHub | Maven | Configuration |
48+ | ----------------------------| ---------------------------------------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -----------------------|
49+ | ** MapStruct** * (required)* | [ mapstruct/mapstruct] ( https://github.com/mapstruct/mapstruct ) | [ org.mapstruct/mapstruct] ( https://mvnrepository.com/artifact/org.mapstruct/mapstruct ) | ` implementation ` |
50+ | | | [ org.mapstruct/mapstruct-processor] ( https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor ) | ` annotationProcessor ` |
51+ | ** Lombok** | [ projectlombok/lombok] ( https://github.com/projectlombok/lombok ) | [ org.projectlombok/lombok-mapstruct-binding] ( https://mvnrepository.com/artifact/org.projectlombok/lombok-mapstruct-binding ) | ` annotationProcessor ` |
52+ | ** Spring** | [ mapstruct/mapstruct-spring-extensions] ( https://github.com/mapstruct/mapstruct-spring-extensions ) | [ org.mapstruct.extensions.spring/mapstruct-spring-annotations] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-annotations ) | ` implementation ` |
53+ | | | [ org.mapstruct.extensions.spring/mapstruct-spring-extensions] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-extensions ) | ` annotationProcessor ` |
54+ | | | [ org.mapstruct.extensions.spring/mapstruct-spring-test-extensions] ( https://mvnrepository.com/artifact/org.mapstruct.extensions.spring/mapstruct-spring-test-extensions ) | ` testImplementation ` |
55+ | ** Camel** | [ apache/camel] ( https://github.com/apache/camel ) | [ org.apache.camel/camel-mapstruct] ( https://mvnrepository.com/artifact/org.apache.camel/camel-mapstruct ) | ` implementation ` |
56+ | | [ apache/camel-spring-boot] ( https://github.com/apache/camel-spring-boot ) | [ org.apache.camel.springboot/camel-mapstruct-starter] ( https://mvnrepository.com/artifact/org.apache.camel.springboot/camel-mapstruct-starter ) | ` implementation ` |
57+ | | [ apache/camel-quarkus] ( https://github.com/apache/camel-quarkus ) | [ org.apache.camel.quarkus/camel-quarkus-mapstruct] ( https://mvnrepository.com/artifact/org.apache.camel.quarkus/camel-quarkus-mapstruct ) | ` implementation ` |
58+ | ** Quarkus** | [ quarkiverse/quarkus-mapstruct] ( https://github.com/quarkiverse/quarkus-mapstruct ) | [ io.quarkiverse.mapstruct/quarkus-mapstruct] ( https://mvnrepository.com/artifact/io.quarkiverse.mapstruct/quarkus-mapstruct ) | ` implementation ` |
59+ | ** Protobuf** | [ entur/mapstruct-spi-protobuf] ( https://github.com/entur/mapstruct-spi-protobuf ) | [ no.entur.mapstruct.spi/protobuf-spi-impl] ( https://mvnrepository.com/artifact/no.entur.mapstruct.spi/protobuf-spi-impl ) | ` implementation ` |
4560
4661## Config
62+
4763Plugin adds configuration block which looks like this:
64+
4865``` groovy
4966mapstruct {
5067 suppressGeneratorTimestamp = true
@@ -60,8 +77,30 @@ mapstruct {
6077}
6178```
6279
63- All parameters used according to official
80+ All parameters used according to official
6481[ documentation] ( https://mapstruct.org/documentation/stable/reference/html/#configuration-options )
6582
83+ ## Troubleshooting
84+
85+ ### MapStruct not generating mappers
86+
87+ Make sure you have the Java plugin applied and that annotation processing is enabled in your IDE.
88+
89+ ### Lombok + MapStruct conflicts
90+
91+ The plugin automatically adds ` lombok-mapstruct-binding ` when Lombok is detected. If you still have issues, ensure
92+ Lombok plugin is applied before MapStruct plugin.
93+
94+ ## Contributing
95+
96+ Contributions are welcome! Please feel free to submit a Pull Request.
97+
98+ 1 . Fork the repository
99+ 2 . Create your feature branch (` git checkout -b feature/amazing-feature ` )
100+ 3 . Commit your changes (` git commit -m 'Add amazing feature' ` )
101+ 4 . Push to the branch (` git push origin feature/amazing-feature ` )
102+ 5 . Open a Pull Request
103+
66104## License
105+
67106[ ![ FOSSA Status] ( https://app.fossa.com/api/projects/git%2Bgithub.com%2FAkaZver%2Fmapstruct-plugin.svg?type=large )] ( https://app.fossa.com/projects/git%2Bgithub.com%2FAkaZver%2Fmapstruct-plugin?ref=badge_large )
0 commit comments