我正在使用maven-ant-tasks-2.0.10.jar和build.xml来编译Drools规则。
规则是这样的:
package example
//list any import classes here.
import example.util.Util;
//declare any global variables here
global example.util.Util util;
rule "Simple rule 1"
dialect "mvel"
when
//conditions
then
//actions
util.handleIssue( "Simple rule 1 executed..." );
end
Util类的方法如下所示:
public class Util {
// Agent is a Spring Injected Dependency.
private Agent agent;
public void handleIssue( MyObject mo ) throws JAXBException {
try {
// This is a SOAP call using a WSDL to an external Spring-WS service.
agent.performTask( "dataneeded" );
} catch( SoapFaultClientException sfce ) {
// TODO
}
public void agent( Agent agent ) {
this.agent = agent;
}
}
尝试编译build.xml时,以SoapFaultClientException的形式返回错误。显然,maven-ant-tasks-2.0.10.jar / drools编译器无法识别Spring-Injected依赖项,可能甚至不关心或了解Spring。
如何使依赖关系对maven-ant-tasks-2.0.10.jar可见,以便drools规则可以编译并正常运行?我是否滥用Drools的方式?有没有人知道如何使用Spring-Inject依赖项(Spring Web Services)的Java对象编译规则?
当我拿出调用Web服务的部分时,它编译得很好。