Drools- Rule Compilation error name cannot be resolved to a variable Syntax error, insert ";" to complete Statement

tls11 picture tls11 · Sep 28, 2016 · Viewed 7.8k times · Source

I'm trying to build a simple rule on KIE Workbench/Drools in a new DRL file and I keep getting the following error on build & deploy

Rule Compilation error name cannot be resolved to a variable Syntax error, insert ";" to complete Statement

here's the code:

package demo.people.peopleproject
import demo.people.peopleproject.Person

rule "is18rule"
    when 
        Person(age>=18)
    then
        System.out.println(name  + "is 18 or over")
end

and here's a screenshot of my work bench if helpful enter image description here

I'm new to Drools, TIA for your help :)

EDIT: I should add that simply adding a ; really anywhere here hasn't helped, so, yes, I have tried that

Answer

tls11 picture tls11 · Sep 28, 2016

I found the answer- if helpful to anyone in the future- here's the code that ended up working for me. Needed semicolons and slightly different syntax.

package demo.people.peopleproject
import demo.people.peopleproject.Person;

rule 'is18rule'
    when 
        p: Person(age >= 18)
    then
        System.out.println(p.getName() + "is 18 or over.");
end