Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-7261

kie-maven-plugin cannot work with lombok

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 8.31.0.Final
    • executable model
    • None
    • 2023 Week 15-17 (from Apr 10)
    • Hide

      pom.xml:

      <!-- lombok mvn dependency -->
      <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.24</version>
      <scope>provided</scope>
      </dependency>
      
      <!-- kie-maven-plugin version
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>8.31.1.Final</version>
        <extensions>true</extensions>
      </plugin>

      sample java code:

      package org.example;
      import lombok.Data;
      import lombok.Builder;
      
      @Data @Builder
      public class Foobar {
        public static void main(String[] args) {
          Foobar.builder().build();
        }
      }
      Show
      pom.xml: <!-- lombok mvn dependency --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.24</version> <scope>provided</scope> </dependency> <!-- kie-maven-plugin version <plugin> <groupId>org.kie</groupId> <artifactId>kie-maven-plugin</artifactId> <version>8.31.1.Final</version> <extensions> true </extensions> </plugin> sample java code: package org.example; import lombok.Data; import lombok.Builder; @Data @Builder public class Foobar { public static void main( String [] args) { Foobar.builder().build(); } }
    • NEW
    • NEW
    • ---
    • ---

      I found that build would fail if I call lombok-generated method in java code. And it's kind of weird because it happens even if I remove the kmodule.xml file.

      Using lombok-generated method in drl is ok.

      Running unit test in Idea with dynamic load model also works well.

      ks.newKieBuilder(kfs).buildAll(ExecutableModelProject.class)

      Error message from kie-maven-plugin: Unable to create KieModule

      Message: The method builder() is undefined for the type Foobar.

              mfusco@redhat.com Mario Fusco
              zheng-weihao Weihao Zheng (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: