Chapter 3. Installing supporting tools

3.1. Using the Maven repository in your project

Red Hat Decision Manager is designed to be used in combination with the Red Hat Decision Manager Maven repository. You can direct Maven to use the Red Hat Decision Manager Maven repository in your project in one of the following ways:

  • Configure the Project Object Model (POM) file (pom.xml).
  • Modify the Maven settings.xml file. This file is included with Maven repository available for download from the Red Hat Customer Portal.

Red Hat recommends directing Maven to use the Red Hat Decision Manager Maven repository across all projects by using the Maven global or user settings.

3.1.1. Configuring Maven using the project configuration file (pom.xml)

To use Maven for building and managing your Red Hat Decision Manager projects, you must configure your projects to be built with Maven. Maven requires the POM file (pom.xml) that holds configuration details for your project. For more information, see Apache Maven Project.

Procedure

  1. Generate a Maven project. A pom.xml file is automatically generated when you create a Maven project.
  2. Edit pom.xml to add more dependencies and new repositories.

    Maven downloads all of the JAR files and the dependent JAR files from the Maven repository when you compile and package your project.

Find the schema for the pom.xml file at http://maven.apache.org/maven-v4_0_0.xsd. For more information about POM files, see Apache Maven Project POM.

3.1.2. Configure Maven using the settings file

The Maven settings file (settings.xml) is used to configure Maven execution. You can locate this file in the following locations:

  • In the Maven install directory at $M2_HOME/conf/settings.xml. These settings are called global settings.
  • In the user’s install directory at $USER_HOME/.m2/settings.xml. These settings are called user settings.
  • A custom location specified by the system property kie.maven.settings.custom.
Note

The settings used is a merge of the files located in these locations. For more information, see Apache Maven Project.

3.1.3. Managing Maven dependencies

Prerequisite

To use the correct Maven dependencies in your Red Hat Decision Manager project, you must add relevant bill of materials (BOM) files to the project’s pom.xml file. When you add the BOM files, the correct versions of transitive dependencies from the provided Maven repositories are included in the project.

For information, see What is the mapping between RHDM product and maven library version?

Procedure

  1. Declare the BOM in pom.xml. For example:

    Example 3.1. BOM for Red Hat Decision Manager 7.0.0

    <dependencyManagement>
     <dependencies>
      <dependency>
       <groupId>org.jboss.bom.rhdm</groupId>
       <artifactId>rhdm-platform-bom</artifactId>
       <version>7.0.0.Final-redhat-4</version>
       <type>pom</type>
       <scope>import</scope>
      </dependency>
     </dependencies>
    </dependencyManagement>
    <dependencies>
    <!-- Your dependencies -->
    </dependencies>
  2. Declare dependencies needed for your project in the <dependencies> tag.

    • For a basic Red Hat Business Automation project, declare the following dependencies:

      Embedded jBPM Engine Dependencies

      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-kie-services</artifactId>
      </dependency>
      
      <!-- Dependency needed for default WorkItemHandler implementations. -->
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-workitems-core</artifactId>
      </dependency>
      
      <!-- Logging dependency. You can use any logging framework compatible with slf4j. -->
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>
      
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
      </dependency>

    • For a Red Hat Business Automation project that uses CDI, declare the following dependencies:

      CDI-Enabled jBPM Engine dependencies

      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-kie-services</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-services-cdi</artifactId>
      </dependency>

    • For a basic Red Hat Decision Manager project, declare the following dependencies:

      Embedded Drools Engine Dependencies

      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-compiler</artifactId>
      </dependency>
      
      <!-- Dependency for persistence support. -->
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-persistence-jpa</artifactId>
      </dependency>
      
      <!-- Dependencies for decision tables, templates, and scorecards.
      For other assets, declare org.drools:drools-workbench-models-* dependencies. -->
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-decisiontables</artifactId>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-templates</artifactId>
      </dependency>
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-scorecards</artifactId>
      </dependency>
      
      <!-- Dependency for loading KJARs from a Maven repository using KieScanner. -->
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-ci</artifactId>
      </dependency>

    • To use the Decision Server, declare the following dependencies:

      Client Application Decision Server Dependencies

      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-client</artifactId>
      </dependency>
      <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-api</artifactId>
      </dependency>
      
      <!-- Dependency for Red Hat JBoss BRMS functionality. -->
      <dependency>
        <groupId>org.drools</groupId>
        <artifactId>drools-core</artifactId>
      </dependency>
      
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-api</artifactId>
      </dependency>

    • To create a remote client for Red Hat Business Automation or Red Hat Decision Manager, declare the following dependencies:

      Client Dependencies

      <dependency>
        <groupId>org.uberfire</groupId>
        <artifactId>uberfire-rest-client</artifactId>
      </dependency>

    • To use assets in KJAR packaging, the recommended way is to include kie-maven-plugin:

      Kie Maven Plugin

      <packaging>kjar</packaging>
      <build>
       <plugins>
        <plugin>
         <groupId>org.kie</groupId>
         <artifactId>kie-maven-plugin</artifactId>
         <version>7.0.0.Final-redhat-4</version>
         <extensions>true</extensions>
        </plugin>
       </plugins>
      </build>

3.2. Importing projects from Git repositories

Git is a distributed version control system. It implements revisions as commit objects. When you commit your changes into a repository, a new commit object in the Git repository is created. When you create a project in Decision Central it is added to the Git repository connected to Decision Central.

If you have projects in other Git repositories, you can import them into Decision Central spaces.

Prerequisite

Red Hat Decision Manager projects in an external Git repository

Procedure

  1. In Decision Central, click MenuDesignProjects.
  2. Select or create the space into which you want to import the projects. The default space is myteam.
  3. Click the three verticle dots on the right side of the screen and select Import Project.
  4. In the Import Project window, enter the URL and credentials for the Git repository that contains the projects that you want to import and click Import. The projects are added to the current space.

3.3. Installing and setting up Red Hat JBoss Developer Studio

Red Hat JBoss Developer Studio is the JBoss Integrated Development Environment (IDE) based on Eclipse. Red Hat JBoss Developer Studio provides plug-ins with tools and interfaces for Red Hat Decision Manager.

Procedure

  1. Download the latest Red Hat JBoss Developer Studio from the Red Hat Customer Portal.
  2. Follow the setup and installation instructions in the Red Hat JBoss Developer Studio documentation.
  3. Install the Red Hat JBoss Developer Studio plug-ins, as described in the next section.
Important

Because of an issue in the way multi-byte rule names are handled, you must ensure that the instance of Red Hat JBoss Developer Studio is started with the file encoding set to UTF-8. You can do this by editing the $JBDS_HOME/studio/devstudio.ini file and adding the following property: "-Dfile.encoding=UTF-8".

3.3.1. Installing Red Hat JBoss Developer Studio plug-ins

Red Hat JBoss Developer Studio provides plug-ins with tools and interfaces for Red Hat Decision Manager. These plug-ins are based on the community version of these products. For this reason, the Red Hat Decision Manager plug-in is called the Drools plug-in.

Get the latest Red Hat JBoss Developer Studio from the Red Hat Customer Portal. The Red Hat Decision Manager plug-ins for Red Hat JBoss Developer Studio are available using the update site.

Procedure

  1. Start Red Hat JBoss Developer Studio.
  2. Click HelpInstall New Software.
  3. Click Add to enter the Add Repository menu.
  4. Provide a name next to the Name field and add the following URL in the Location field: https://devstudio.jboss.com/11/stable/updates/integration-stack/.
  5. Click OK.
  6. Select the JBoss Business Process and Rule Development feature from the available options, click Next, and then click Next again.
  7. Read the license and accept it by selecting the appropriate radio button, and click Finish.
  8. Restart Red Hat JBoss Developer Studio after the installation process finishes.

3.3.2. Configuring the Red Hat Decision Manager server

You can configure Red Hat JBoss Developer Studio to run the Red Hat Decision Manager server.

Prerequisite

  • Red Hat JBoss Developer Studio
  • Red Hat Decision Manager installed with the Red Hat JBoss Developer Studio plug-ins

Procedure

  1. Start Red Hat JBoss Developer Studio.
  2. To open the Drools view, click WindowOpen PerspectiveOther, select Drools, select specific views, and click OK.
  3. Click WindowShow ViewOther…​ and select ServerServers to add the server view.
  4. Right click the Servers panel and select NewServer to open the server menu.
  5. Click JBoss Enterprise MiddlewareJBoss Enterprise Application Platform 7.1+ and click Next to define the server.
  6. Set the home directory by clicking the Browse button. Navigate to theRed Hat JBoss EAP directory where Red Hat Decision Manager is installed.

    To configure the Red Hat Decision Manager server, select the Red Hat JBoss EAP directory where Red Hat Decision Manager is installed.

  7. Provide a name for the server in the Name field, ensure that the configuration file is set, and click Finish.

3.3.3. Importing projects from a Git repository into Red Hat JBoss Developer Studio

You can configure Red Hat JBoss Developer Studio to connect to a central Git asset repository. The repository stores rules, models, functions, and processes.

You can either clone a remote Git repository or import a local Git repository.

3.3.4. Cloning a remote Git repository

You can clone a git repository to use with Red Hat JBoss Developer Studio.

Prerequisite

Access permission for the remote Git repository that you want to clone

Procedure

  1. In Red Hat JBoss Developer Studio, select the server from the Server tab and click the start icon to start your server.
  2. Enter the following command in a terminal to start the Secure Shell server, if it is not running already.

    /sbin/service sshd start
    Note

    This command is specific to Linux and Apple Macintosh. On these platforms, if sshd has already been started, this command fails. If this happens, you may safely ignore this step.

  3. In Red Hat JBoss Developer Studio , select FileImport…​ and navigate to the Git folder. Open the Git folder to select Projects from Git and click Next.
  4. Select the repository source as Clone URI and click Next.
  5. Enter the details of the Git repository in the next window and click Next.
  6. Select the branch you wish to import in the following window and click Next.
  7. To define the local storage for this project, enter (or select) a non-empty directory, make any configuration changes and click Next.
  8. Import the project as a general project in the following window and click Next.
  9. Name the project and click Finish.

3.3.5. Importing a local Git repository

You can import a local git repository to use with Red Hat JBoss Developer Studio.

Procedure

  1. Select your server from the Server tab and click the start icon to start the server.
  2. In Red Hat JBoss Developer Studio, select FileImport…​ and navigate to the Git folder. Open the Git folder to select Projects from Git and click Next.
  3. Select the repository source as Existing local repository and click Next.
  4. Select the repository that is to be configured from the list of available repositories and click Next.
  5. In the dialog window that opens, select the Import as general project radio button from the Wizard for project import group and click Next.
  6. Name the project and click Finish.