Plugin
Submitted by Ansgar.Konermann on January 22, 2011 - 04:13
Maven Drools Plugin
The Maven Drools Plugin supports compilation of knowledge source code (*.DRL) for the Drools Rule Engine into a binary format suitable for both loading into the rule engine and re-using while compiling other knowledge source files.
The whole process is a lot like compiling Java classes and packaging them as JARs:
- You can use the JAR to run the compiled code by loading it into the JVM
- Or you could re-use the classes from the JAR by putting them on the compile-classpath of another Java compiler run in a different project which depends on your JAR.
Besides re-using Drools knowledge artifacts, the plugin also supports specifying which Java JAR files you want to have available in your Drools knowledge sources.

Is it supports ruleflows as
Is it supports ruleflows as well?
Rule Flows Support
Hi,
thanks for your question. I think it's a good idea to add rule flows support to the plugin. At the moment, there is no support for it yet. As the plugin basically just adds a maven-style modularity layer on top of the Drools compiler API (KnowledgeBuilder class), and the compiler API already supports Drools Rule Flow (*.DRF) files, it should actually be quite easy to implement this feature.
I'm busy setting up a permanent public issue tracker for this project. For the time being, I'll create an issue to keep track of your idea. I'm going to announce the issue tracker's location once it's ready, and it would be nice of you "vote" for this feature to express your interest in using this feature.
Best regards
Ansgar
Unable to resolve dependency
Hello; thanks for writing this. I'm trying to pull this from your Maven repository (which I have referenced in my settings.xml as a
<pluginRepository>--I'm not new to this), and it says this:[ERROR] Unresolveable build extension: Plugin de.lightful.maven.plugins:maven-drools-plugin:0.0.7 or one of its dependencies could not be resolved: Failed to collect dependencies for de.lightful.maven.plugins:maven-drools-plugin:jar:0.0.7 (): No versions available for org.drools:drools-core:jar:[5.1.1] within specified range -> [Help 2]I'm actually specifying
5.2.0-SNAPSHOTas the version ofdrools-compilerI'd like to use, so[5.1.1]doesn't show up in my plugin stanza.Any ideas?
Best,
Laird
Drools Versions
Hi,
thanks for commenting. Turns out I actually pinned the Drools version to [5.1.1] in the master pom.xml of this project. This means: though it is possible to specify a Drools version, the plugin only allows version range [5.1.1] -- which is actually quite limited ;-) It should probably also allow 5.0.x, but IIRC 5.2 has a somewhat different packaging, so supporting both 5.0.x, 5.1.x and 5.2 series of Drools in the same plugin is probably not trivial.
As 5.1.1 this is the most recent stable version of Drools, this should not (yet) pose any problems unless you actually need the added features of the 5.2 series.
Please let me know if it's okay for you to use 5.1.1 for the time being. Depending on the complexity of API and packaging changes between 5.1 and 5.2, I'll probably adress this in one of the next versions of the plugin.
Best regards
Ansgar
Multiple Drools Versions
Hi,
Multiple Drools Runtime are now supported. You need to define three dependencies for the maven-drools-plugin (see example pom above for example). One pitfall when working with Drools 5.1.1: one of the artifacts was renamed between 5.1.1 and 5.2.0.Final. For 5.1.1, use <artifactId>drools-api</artifactId> instead of <artifactId>knowledge-api</artifactId>.
Best regards
Ansgar