As shown below, when `` `gradle test``` is done, JUnit 5 fails to execute due to lombok and so on.
> gradle test
Hoge.java:3: error: package lombok does not exist
import lombok.Data;
^
Hoge.java:5: error: cannot find symbol
@Data
^
symbol: class Data
2 errors
FAILURE: Build failed with an exception.
lombok with `` `testCompileOnlyand
testAnnotationProcessor```, as at https://medium.com/@tsuyoshiushio/gradle-5-0-with-lombok-and-spring-boot-e8ca564fc552 Put in. I don't understand the details well, but I think I have to set lombok annotation processing to be effective even at test time.
dependencies {
compileOnly("org.projectlombok:lombok:${lombokVersion}")
testCompileOnly("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
}
Recommended Posts