问题
在Intellij IDEA 2016下,默认安装了Drools的插件,但使用Drools7(其他版本应该也有问题)时发现,在DRL文件中引入的静态方法IDEA会提示“Cannot resolve”,而代码可以正常执行。
示例
定义了DroolsStringUtils类,类中有一个isEmpty的静态方法,在drl文件中的代码如下:
package com.rules import static com.utils.DroolsStringUtils.isEmpty; import com.model.Product; rule CheckIsEmpty when eval(isEmpty("")); then System.out.println(111); end
此时,IDEA会有如下提示:查找了各种解决方案,暂时无法解决。但正常运行时不影响程序的执行。
可能的原因是目前Intellij idea2016.3 只支持drools版本到6.2.0的原因吧。感兴趣或有答案的朋友可以研究回复一下。