I'm working on a java 8 gradle project in Eclipse (2019-09) including lombok. I would love to use mapstruct for converting models into dto and vice versa. Mapstruct works great.
Problem: I have some trouble that Eclipse creates and compiles the mapper implementation when saving the file. The XYMapperImpl.java/class files are only created when using ./gradlew classes. Building it with gradle is not really an option because it takes some time and does not really work in my workflow. I need to have the .class file at the end to mount the whole /bin folder into a docker container.
I'm using the Eclipse MapStruct plugin, however this is only for Code Completion and Quick Fixes but not for generating class files.
I've done some research: How to get Eclipse to generate MapStruct Mappers using Gradle or How to properly integrate MapStruct with Eclipse? (Including Lombok java agent) and some others without any success.
Maybe I missed something?
My build.gradle file:
plugins {
id 'java'
id "net.ltgt.apt-eclipse" version "0.21"
id "net.ltgt.apt" version "0.21"
}
apply plugin: "java"
apply plugin: "net.ltgt.apt-eclipse"
apply plugin: "net.ltgt.apt"
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.10'
compile "org.mapstruct:mapstruct-jdk8:1.3.0.Final"
annotationProcessor "org.mapstruct:mapstruct-processor:1.3.0.Final" //Must be defined before the lombok annotationProcessor
annotationProcessor 'org.projectlombok:lombok:1.18.6'
}
I've created a simple demo project as an example.