2015-01-20 60 views
2

我有一種情況。我正在用kie-spring測試一堆.drl文件。只有當DRL文件位於src/test/resources文件夾中而不在src/main/resources /文件夾中時,纔會查找/掃描DRL文件。Drools --- JUnit測試 - Drools Spring不掃描源文件夾中的包

我甚至將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 -plasses

以下是我的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> 

回答

1

我解決了在pom.xml中添加的src/main /資源testResources

<build> 
    <testResources> 
     <testResource> 
      <directory>${basedir}/src/test/resources</directory> 
     </testResource> 
     <testResource> 
      <directory>${basedir}/src/main/resources</directory> 
     </testResource> 
    </testResources> 
</build>