1 Reply Latest reply on Jan 9, 2019 7:36 PM by msatti

    jBPM and Java 1.8

    msatti

      Hi all,

       

      First of all, apologies if this isn't the right place to post this, I'm fairly new to the KIE Suite

       

      I am running a Java EE web application and I'm having trouble compiling a bunch of .bpmn files that contain Java script nodes.

      When I attempt to compile the flows, I get errors saying

       

      Syntax error, <offending syntax> only available if source level is 1.5 or greater

       

      I am using Java 1.8 and version 7.15.0 for .jar's related to Drools/jBPM/KIE

      My project is structured with the .bpmn files inside src/main/resources and I have a kmodule.xml inside src/main/resources/META-INF/kmodule.xml

      The contents of my kmodule are as followed:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" />
      

      I am then creating a KieSession object in the java code.

       

      public KieSession getKieSession() {
        KieServices kieServices = KieServices.Factory.get();
        KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
        kieBaseConfiguration.setProperty("drools.dialect.java.lngLevel", "1.8");
        return kieServices.getKieClasspathContainer().newKieBase(kieBaseConfiguration).newKieSession();
      }

       

      Line 4 was my attempt at trying to set the Java language level, however this didn't work. I looked at the documentation here: KIE :: Public API 7.15.0.Final API

      and it seems that property was for an older version (KnowledgeBuilderConfiguration (Knowledge API 5.2.0-SNAPSHOT API)), it doesn't exist anymore. My question is how do I configure KIE to compile using Java 1.8?

        • 1. Re: jBPM and Java 1.8
          msatti

          It turns out an old ecj dependency was being pulled in via one of the project dependencies. I added the following to my pom.xml to override the dependency:

          <dependency>

            <groupId>org.eclipse.jdt.core.compiler</groupId>

            <artifactId>ecj</artifactId>

            <version>4.6.1</version>

          </dependency>

          and now it compiles properly