Chapter 9. Setting Maven dependencies in your project
You can use an external Maven repository to deploy a project. When you create a project, Decision Central uses the Maven repositories that are configured for Decision Central. You can use the Maven global or user settings to direct all Red Hat Decision Manager projects to retrieve dependencies from the public Red Hat Decision Manager repository by modifying the following files:
-
The Maven
settings.xmlfile. -
The Maven project object model (POM) file (
pom.xml).
For more information, see Packaging and deploying a Red Hat Decision Manager project.
9.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 create and configure the POM file (pom.xml). This file holds configuration information for your project. For more information, see Apache Maven Project.
Procedure
-
Generate a Maven project. A
pom.xmlfile is automatically generated when you create a Maven project. Edit the
pom.xmlfile 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.
9.2. Modify the Maven settings file
Red Hat Decision Manager uses Maven settings.xml file to configure it’s Maven execution. You must create and activate a profile in the settings.xml file and declare the Maven repositories used by your Red Hat Decision Manager projects.
Procedure
-
In the
settings.xmlfile, declare the repositories that your Red Hat Decision Manager projects use. Usually, this is either the online Red Hat Decision Manager Maven repository or the Red Hat Decision Manager Maven repository that you download from the Red Hat Customer Portal and any repositories for custom artifacts that you want to use. -
Ensure that Decision Central or Decision Server is configured to use the
settings.xmlfile, for example by specifying thekie.maven.settings.custom=<path_to_settings.xml>property.
For information about the Maven settings.xml file, see the Apache Maven Project Setting Reference.
9.3. Modify the Maven POM file
To use the correct Maven dependencies in your Red Hat Decision Manager project, add the Red Hat Business Automation bill of materials (BOM) files to the project’s pom.xml file. The Red Hat Business Automation BOM applies to both Red Hat Decision Manager and Red Hat Process Automation Manager. When you add the BOM files, the correct versions of transitive dependencies from the provided Maven repositories are included in the project.
For more information about the Red Hat Business Automation BOM, see What is the mapping between Red Hat Decision Manager and the Maven library version?.
Procedure
Declare the Red Hat Business Automation BOM in the
pom.xmlfile:<dependencyManagement> <dependencies> <dependency> <groupId>com.redhat.ba</groupId> <artifactId>ba-platform-bom</artifactId> <version>7.1.0.GA-redhat-00002</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Your dependencies --> </dependencies>
-
Declare dependencies required for your project in the
<dependencies>tag. After you import the product BOM into your project, the versions of the user-facing product dependencies are defined so you do not need to specify the<version>sub-element of these<dependency>elements. However, you must use the<dependency>element to declare dependencies which you want to use in your project. For standalone projects that are not authored in Decision Central, specify all dependencies required for your projects. In projects that you author in Decision Central, the basic decision engine dependencies are provided automatically by Decision Central.
- For a basic Red Hat Decision Manager project, declare the following dependencies, depending on the features that you want to use:
For a basic Red Hat Decision Manager project, declare the following dependencies:
Embedded decision 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>
To create a remote client for Red Hat Decision Manager, declare the following dependency:
Client dependency
<dependency> <groupId>org.uberfire</groupId> </dependency>
When creating a JAR file that includes assets, such as rules and process definitions, specify the packaging type for your Maven project as
kjarand useorg.kie:kie-maven-pluginto process thekjarpackaging type located under the<project>element. In the following example,${kie.version}is the Maven library version listed in What is the mapping between Red Hat Decision Manager and the Maven library version?:<packaging>kjar</packaging> <build> <plugins> <plugin> <groupId>org.kie</groupId> <artifactId>kie-maven-plugin</artifactId> <version>${kie.version}</version> <extensions>true</extensions> </plugin> </plugins> </build>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.