Executable model build fails when a global variable is set in RHS

Solution Verified - Updated -

Issue

If a global variable is set in RHS like the following:

rule "setting_GlobalLogger"
    dialect "mvel"
    when
    then
                drools.workingMemory.setGlobal("logger", org.slf4j.LoggerFactory.getLogger(getClass()));
end

executable model build fails with the error:

[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00017:generateModel (default-generateModel) on project reproducer_setGlobal: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.67.0.Final-redhat-00017:generateModel failed: [com/example/reproducer/P6F/LambdaConsequence6F52E5BBA430E99186E57ACE461419EA.java (25:908) : workingMemory cannot be resolved or is not a field] -> [Help 1]

This does not happen with non-executable model build (i.e mvn build with -DgenerateModel=NO option).

Environment

  • Red Hat Decision Manager
    • 7.13

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content