Drools将来自另一个项目的规则添加到kmodule中? [英] Drools add rules from another project into kmodule?

查看:70
本文介绍了Drools将来自另一个项目的规则添加到kmodule中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此文档说明您可以使用

So the docs state that you can load kie modules programatically with

KieServices ks = KieServices.Factory.get();

KieContainer kieContainer = newKieContainer(ks.newReleaseId("my.org","my.artifact.id","version"));
KieSession kieSession = kieContainer.newKieSession("ktest");

有没有办法通过 maven 和 kmodule.xml
我的用例是在另一个项目中使用我在该项目中编写的规则,然后将其添加到其中。也许我在7.7文档中错过了它,如果是的话,请链接并与我的眼科医生预约。

Is there a way to do that through maven and the kmodule.xml? My use case would be to use the rules I wrote in this project, in another project and add onto them. Maybe I missed it in the 7.7 docs, if so please link and I'll set an appointment with my eye doctor.

附录:
我想 kmodule.xml 看起来类似于:

<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<configuration>
</configuration>
<!-- Shared Knowledgebase -->
<kbase name="am" packages="my.package.name, rules">  
    <ksession name="default" type="stateful" default="true"/>
</kbase>


但是,似乎没有看到包裹

However that does not seem to see the package

谢谢

推荐答案

所以我确实知道了。我认为这与 kmodule.xml 中的 package 有关。但是实际上,它只是添加了 incluldes = package.name ,它自己就搞清楚了。

So I did figure this out. I thought it had something to do with package in the kmodule.xml. But in actuality it was simply adding the incluldes = "package.name" and it figured it out all on its own.

但是,我也建议使用@Prog_G答案,尽管这不是我想要的,但我相信它将帮助其他人解决同样的问题。

However, I also recommend @Prog_G answer as well, though it was not what I was looking for, I'm sure it will help others with this same question.

最终结果:

<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<configuration>
</configuration>
<kbase name="am" packages="rules" includes = "my.package.name">  
    <ksession name="default" type="stateful" default="true"/>
</kbase>

这篇关于Drools将来自另一个项目的规则添加到kmodule中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆