I am getting a weird issue in IntelliJ. I am using Lombok (1.18.2), IntelliJ(2018.2.2) and JUnit 5 in gradle 4 multi-module project.
It took me hours to replicate this.
Run all test case with coverage.
Following a pop up will come
if I press OK and re-run the unit test case. It will start failing with java.lang.NoSuchMethodError for the getters and setters.
removing Lombok and generating getter and setter after this has no effect as well.
Tried everything to fix this (enable annotation processor, Lombok plugin, clean build) but no luck.
EDIT 1:
Root build.gradle:
implementation 'org.projectlombok:lombok:1.18.2'
testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.1')
testImplementation('org.junit.jupiter:junit-jupiter-params:5.3.1')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.3.1')
testImplementation("org.junit.platform:junit-platform-launcher:1.3.1")
testImplementation("org.junit.vintage:junit-vintage-engine:5.3.1")
testImplementation "org.mockito:mockito-core:2.+"
testImplementation('org.mockito:mockito-junit-jupiter:2.22.0')
sub-project build.gradle
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
I solved this issue by making following changes:
Enable annotation processing in Intellij.(File | Settings | Build, Execution, Deployment | Compiler | Annotation Processors)
select processor path and point to lombok-1.18.4.jar because I just want to enable it for Lombok and not for Mapstruct. If enabled for both then it generates the Mapstruct classes in default location.
under File "Invalidate cache and restart"
under Build option "Rebuild project"
This will solve it. It took me a while to make it working in Intellij.