I am trying to adapt drools6.0 for an existing code base (it is maven project under eclipse). I didnt had need to learn drools or maven before (though they were part of my p
I hit similar problems.
I think that part of the problem is trying to live in both worlds. The JBoss Drools eclipse plugin world and the maven world.
I have Eclipse 4.3.1 (Kepler) with various Jboss/Drools plugins installed.
I took a working eclipse example and made sure I could run it in maven.
This should give you a project that builds and runs entirely from Maven.
Add to your pom.xml
org.codehaus.mojo
exec-maven-plugin
1.2.1
And
org.slf4j
slf4j-simple
1.7.2
runtime
Try:
mvn -e exec:java -Dexec.mainClass="com.sample.DroolsTest"
It should produce:
...
[com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found kmodule: file:/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes/META-INF/kmodule.xml
[com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added:FileKieModule[ ReleaseId=x:x:1.0file=/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes]
[com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.ClasspathKieProject - Found kmodule: file:/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes/META-INF/kmodule.xml
[com.sample.DroolsTest.main()] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added:FileKieModule[ ReleaseId=x:x:1.0file=/Users/davidbernard/Projects/action-deducing-diff/xx/target/classes]
Hello World
Goodbye cruel world
...
You should now also be able to run DroolsTest from eclipse.
You will have a rules->Sample.drl file and a kmodule.xml file.
The "ksession" name should match the code creating the ksession:
KieSession kSession = kContainer.newKieSession("ksession-rules");
The "packages" should match the directory the rule file is in.