Basic Concepts

Maven Drools Plugin: Basic concepts

Rules made available to the Drools rule engine in its most basic form are defined using text files ending in .drl. Although Drools does support other file formats for various other knowledge types, these formats are out of scope unless a plugin user requests support for them.

The textual rule representation has to be converted into a more suitable form before they can be run inside the Drools rule engine. There are various options regarding the how and when to perform this conversion, details of which can be found in the Drools Expert User Guide. This conversion step is called building or compiling the rule source code.

This plugin is intended to support rules compilation as part of a Maven build, which could run locally on a developer machine or on a continuous integration server. In addition, it allows you to deploy the compiled rule artifacts into a Maven repository for later (re-) use. You can even use a deployed rules artifact as a Maven dependency of another rules project, which comes handy if one subset of your rule base contains a function definition or a declared type which should be used in another, distinct subset of your rule base.

To allow for this kind of reuse, the plugin defines a new Maven packaging type called knowledge-module. The file extension assigned to the resulting artifacts is .dkm which stands for Drools Knowledge Module. For the time being, files of this type merely contain a Collection<KnowledgePackage>, but this will change in the near future: there will be a header with various version numbers prepended.