Chapter 3. Migrating Java projects
For Java projects that are not developed in Business Central workbench, you must modify the dependencies in the pom.xml file and resolve any build issues. This process is the same for decision services and client applications written in Java.
Prerequisite
You must download the Maven repository for Red Hat Decision Manager 7.0 and make it available to the local Maven installation (as a local or remote repository).
Procedure
-
Open the
pom.xmlfile of the project. Remove the
<version>tag from any dependencies under the following groups:-
org.kie -
org.drools -
org.jbpm -
org.optaplanner
-
Add the following dependency under the
<dependencies>tag within the<dependencyManagement>section:<dependency> <groupId>org.jboss.bom.rhdm</groupId> <artifactId>rhdm-platform-bom</artifactId> <version>${rhdm.version}</version> <scope>import</scope> <type>pom</type> </dependency>Where
${rhdm.version}is the version of theorg.jboss.bom.rhdm:rhdm-platform-bomartifact in the Maven repository for Red Hat Decision Manager 7.0. You can view the version of the artifact by entering the repository and navigating tomaven-repository/org/jboss/bom/rhdm/rhdm-platform-bomdirectory; the name of the only subdirectory in this directory is the version. For example,7.0.0.GA-redhat-1.If your code uses any Drools CDI annotations (
@KReleaseId,@KContainer,@KBase,@KSession), also add the following dependency:<dependency> <groupId>org.drools</groupId> <artifactId>drools-cdi</artifactId> </dependency>
This dependency is necessary because the CDI extension for processing the annotations is now defined using a separate module. Without this dependency, the annotations do not work.
Replace the legacy
org.guvnordependency (if applicable) with the neworg.uberfiredependency.Legacy
org.guvnordependency:<dependency> <groupId>org.guvnor</groupId> <artifactId>guvnor-rest-client</artifactId> </dependency>
New
org.uberfiredependency:<dependency> <groupId>org.uberfire</groupId> <artifactId>uberfire-rest-client</artifactId> </dependency>
-
Update the version of the project artifact and save the
pom.xmlfile. - Rebuild the project, using a regular Maven build.
- If build errors or subsequent execution errors happen, resolve them using the information in Section 3.1, “Troubleshooting build and execution errors in migrated Java projects”.
3.1. Troubleshooting build and execution errors in migrated Java projects
Use the following information to resolve any build or execution errors after rebuilding migrated projects for Red Hat Decision Manager 7.0.
3.1.1. API changes in Drools modules
The following Drools modules include some incompatible changes from BRMS 6.4 to Red Hat Decision Manager 7.0:
kie-api: the main API for all projects from KIE Group. The majority of changes are in the following classes:-
org.kie.api.task.* -
org.kie.api.executor.* -
org.kie.api.concurrent.* -
org.kie.api.builder.* -
org.kie.api.command.* -
org.kie.api.runtime.*
-
drools-core: the rules engine. The changed classes are:-
org.drools.core.command.* -
org.drools.core.common.*
-
kie-server-api: the general API, including commands,model and so on, for KIE Server (Decision Server). The changed classes are:-
org.kie.server.api.commands.* -
org.kie.server.api.marshalling.* -
org.kie.server.api.model.* -
org.kie.server.api.rest.RestURI(constants have slightly changed, omitting leading/)
-
kie-server-controller-api: the API for the KIE Server Controller. The changed classes are:-
org.kie.server.controller.api.service.*
-
kie-server-controller-rest: the REST API for KIE Server Controller. The changed classes are:-
org.kie.server.controller.rest.RestSpecManagementServiceImpl -
org.kie.server.controller.rest.RestKieServerControllerImpl
-
kie-server-client: the KIE Server Client. The changed classes are:-
org.kie.server.client.SolverServicesClient -
org.kie.server.client.UIServicesClient -
org.kie.server.client.admin.ProcessAdminServicesClient -
org.kie.server.client.ProcessServicesClient -
org.kie.server.client.QueryServicesClient -
org.kie.server.client.JobServicesClient -
org.kie.server.client.UserTaskServicesClient -
org.kie.server.client.KieServicesClient -
org.kie.server.client.KieServicesConfiguration
-
If you encounter build errors with any of the listed classes, review the detailed reports that are available at https://access.redhat.com/articles/3352151 . The reports indicate the API changes. You can use this information to adapt your code to the changes.
3.1.2. Logic changes in Drools modules
The following logic changes were made in Drools modules:
In Red Hat BRMS 6.4, when a rule executes the sum function in an accumulate pattern, the result always returns as a double data type regardless of the data type of the inputs. Red Hat Decision Manager 7.0 preserves the data type of the inputs on which the sum is executed. This enhancement provides a more accurate result from the sum function. In the following example, the result type of the accumulate function is
Longinstead ofdouble:Long(...) from accumulate(..., sum($p.getLongWeight()))
If the rules in your Red Hat BRMS 6.4 project include the sum function in an accumulate pattern, search for these functions and review them. Keep in mind that these functions return a double data type in Red Hat BRMS 6.4, but will return the data type of the input values in Red Hat Decision Manager 7.0.
-
When no fact matches the accumulate pattern, min and max accumulate functions in Red Hat Decision Manager 7.0 do not return
+/-Integer.MAX_VALUE, but returnnull, therefore, unlike BRMS 6.4, the accumulate in the rule is not matched and the rule does not fire.

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.