I am experimenting with the Guided Rule Editor in
Eclipse, but I am unable to get a Guided Rule to parse.
I have created a Drools Project using the basic “Hello
World” example for starters. I’ve created a class called
“Item” with 3 attributes – itemPrice (float), ItemNumber
(int), and itemDescription (String) with getters/setters. I
do a “New-Drools-Guided
Rule” to create a .brl file called “GuidedRule.brl” and get
the “drools.package” created automatically. In
drools.package, I add “package com.sample;” and “import
com.sample.Item;” and save it.
Then I go over to GuidedRule.brl and create a simple rule
in the guided editor (this is the DRL view of it):
rule “GuidedRule”
dialect “mvel”
when
item : Item()
then
item.setItemDescription(“New Description”);
end
When I click “save” I get errors.
On the Generated drl (read only), I get two problems
->
BuildError: Unable to build
expression for 'consequence': Failed to compile: 2
compilation error(s):
- (1,4) unqualified type in
strict mode for: item
- (1,44) unable to resolve
method using strict-mode:
java.lang.Object.setItemDescription(java.lang.String)
' item.setItemDescription( "New Description" );'
On the brl source view, I get an error at the
<attributes> -> BuildError: Unable to resolve
ObjectType 'Item'
It seems to not be able to see my class, which is public,
belonging to the same package, and included as an import in
drools.package. I can get the rule to work if I don’t
reference Item (simple “eval(true)” in the LHS, for
example)….
I am running Drools 5.1.1 on Eclipse 3.5.
Am I overlooking something simple here?