How to load kmodule.xml in non maven project

352 views
Skip to first unread message

Deep Narain Singh

unread,
May 4, 2015, 5:44:49 AM5/4/15
to drools...@googlegroups.com
Hi All,

I have a drools project which is non maven now the issue i am facing is my kmodule.xml is not found while running the application.
does anyone have idea whether we can use kmodule.xml in maven project only and it should be placed in META-INF folder. what if it is a non maven project where should we place the kmodule.xml file. any help will be appreciated.

thanks,
deep

Myrosia Dzikovska

unread,
May 5, 2015, 6:39:58 AM5/5/15
to drools...@googlegroups.com
I am running a non-maven project using ant. Here's my setup - hopefully will be a helpful example

Directory layout:
src/
  main
/
    java
/
     
... Java files
    resources
/
          META
-INF
              kmodule
.xml
          rules
             
... drl files

target
/
   
... class files



My build.xml is set up to compile class files to target, and then it has an additional task to copy the rules and META-INF directory together with the classes

<target name="compile">
<!-- The runtime needs resources on the classpath. For now, we will just copy them to the target directory. In the future, we should make a resource jar -->
 
<copy todir="${target_dir}">
   
<fileset dir="src/main/resources" />
 
</copy>
     
<mkdir dir="${target_dir}"/>
   
<javac srcdir="${source_dir}" destdir="${target_dir}" debug="yes">
     
<classpath>
       
<path refid="classpath"/>
     
</classpath>
   
</javac>
</target>

And then I either put my "target" directory on my classpath, or package it as a jar to run.

Obviously there could be improvements, like packaging resources in a separate jar - this is just  a basic example setup.

Myrosia
Reply all
Reply to author
Forward
0 new messages