Hi,
I have run into an issue when using the kie-maven-plugin to produce the kjar when using Lombok annotation.
This can be reproduced with the sample maven project generated from the
mvn archetype:generate -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-drools-exec-model-ruleunit-archetype -DarchetypeVersion=8.44.0.Final
Modify the Measurement class by adding the @Data, @AllArgsConstructor and @Builder Lombok annotation like below
@Data
@AllArgsConstructor
@Builder
public class Measurement {
private String id;
private String val;
}
Then add the following method to the MeasurementUnit class
public void addMeasurement(String id, String value) {
this.measurements.add(Measurement.builder().id(id).val(value).build());
}
Now do mvn clean package and I get the build failure message:
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:10.1.0:build (default-build) on project drools-test: Execution default-build of goal org.kie:kie-maven-plugin:10.1.0:build failed: Unable to create KieModule, Errors Existed: [Message [id=1, level=ERROR, path=src/main/java/com/abc/MeasurementUnit.java, line=26, column=709
[ERROR] text=The method builder() is undefined for the type Measurement]]
[ERROR] -> [Help 1]
I have tried out Drools v10.1, 10 and 8.4 with Java 8 or 21 and the error is always the same.
I'm using the latest Lombok version, 1.18.40, with their annotationProcessorPaths setting.
I think the issue is kie-maven-plugin doesn't use the code after it is processed and generated by the Lombok annotation processor, so it can't recognize the build() method generated by the Lombok. Is there any workaround of it?
Thanks,
Steven