gradle can't find lombok generated constructor in integration test
I believe the crucial bit that you are missing is an annotation processor configuration for your integrationTest
source set:
integrationTestAnnotationProcessor "org.projectlombok:lombok:1.18.6"
In the following, you can find a self-contained, working example (tested with Gradle 5.3.1). It’s not exactly your project but should be close enough to get you on track:
build.gradle
apply plugin: 'java'
sourceSets {
integrationTest {
java.srcDir 'src/testInteg/java'
resources.srcDir 'src/testInteg/resources'
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath + sourceSets.test.runtimeClasspath
}
repositories {
jcenter();
}
dependencies {
implementation "org.projectlombok:lombok:1.18.6"
testImplementation "junit:junit:4.11"
integrationTestAnnotationProcessor "org.projectlombok:lombok:1.18.6"
}
src/testInteg/java/MyTest.java
public class MyTest {
@org.junit.Test
public void test() {
new Person("foo", "bar");
assert true;
}
@lombok.AllArgsConstructor
private class Person {
private String id;
private String name;
}
}
I also found the same issue and fixed by adding testAnnotationProcessor beside annotationProcessor to build.gradle:
annotationProcessor "org.projectlombok:lombok:${lombok_version}"
testAnnotationProcessor "org.projectlombok:lombok:${lombok_version}"