Search code examples
droolsdrools-guvnor

Package Drools Rule into a deployable package from the command line


I'm using Drools 6.2.0. Currently, I'm modifying Drools rule in the Guvnor and build it (on the GUI.) The result is a Jar file.

Now, I want to build it on the command-line. Section 4.2 in the documentation https://docs.jboss.org/drools/release/6.2.0.Final/drools-docs/html_single/#BuildDeployUtilizeAndRunSection seems like the answer.

Building it on the command-line require sources. What are the sources and how do I export them if I previously edited them in the GUI ?


Solution

  • Starting from Drools 6.0 Guvnor was renamed as Kie-Workbench. In fact, this was not just a rebranding, but a heavy refactor and reimplementation of it. One of the major changes introduced by the Kie-Workbench was that it now relies on Git to store all its projects and assets.

    Each of the projects you see in the Kie-Workbench is in fact a Maven project stored in a local Git repository. You can get more information about this topic here.

    So, the required steps to build your own kjar (this is what a Drools' deployable jar is called) are simple:

    1. Clone the repository you want (you can get the URL you need to use to clone it from the "Repository Editor" section)
    2. From the command line navigate to the project you want to build inside the repository you just cloned.
    3. execute mvn clean package kie:build
    4. The kjar will be generated in the target directory. Note that the extension of this kjar is still .jar.

    Hope it helps,