2

我有一个情况。我正在使用 kie-spring 测试一堆 .drl 文件。仅当 DRL 文件位于 src/test/resources 文件夹中而不是 src/main/resources/ 文件夹中时,才能找到/扫描 DRL 文件。

我什至将 drl 文件与 kie-spring .xml 文件一起移到了单独的 jar 项目/文件中的 src/main/resources 文件夹中。还是没有运气!以下是我得到的警告!

2014-09-30 15:24:51,227 [AbstractKieModule] [main] WARN 未找到 KieBase MASTRT_KBase 的文件,搜索文件夹 \Users\mmadhavan.FACS_ORG\workspace\org.ncdb.facs.measures\target\test-classes

以下是我的xml文件!

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kie="http://drools.org/schema/kie-spring"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://camel.apache.org/schema/spring       http://camel.apache.org/schema/spring/camel-spring.xsd

        http://drools.org/schema/kie-spring http://drools.org/schema/kie-spring.xsd">


    <kie:kmodule id="kbase_inlist_op_test_rules">
        <kie:kbase name="MASTRT_KBase" packages="org.xxx.xxx.xxxxx.drl.cancer.MASTRT">
            <kie:ksession name="MASTRT_KSession" type="stateless" scope="prototype"/>
        </kie:kbase>
    </kie:kmodule>



    <bean id="kiePostProcessor" class="org.kie.spring.annotations.KModuleAnnotationPostProcessor"/>
</beans>
4

1 回答 1

1

我解决了在 pom.xml 中将 src/main/resources 添加到 testResources

<build>
    <testResources>
        <testResource>
            <directory>${basedir}/src/test/resources</directory>
        </testResource>
        <testResource>
            <directory>${basedir}/src/main/resources</directory>
        </testResource>
    </testResources>
</build>
于 2016-07-11T14:56:10.183 回答