Chapter 3. Creating and executing DMN and BPMN models using Maven
You can use Maven archetypes to develop DMN and BPMN models in VSCode using the Red Hat Process Automation Manager VSCode extension instead of Business Central. You can then integrate your archetypes with your Red Hat Process Automation Manager decision and process services in Business Central as needed. This method of developing DMN and BPMN models is helpful for building new business applications using the Red Hat Process Automation Manager VSCode extension.
Procedure
- In a command terminal, navigate to a local folder where you want to store the new Red Hat Process Automation Manager project.
Enter the following command to generate a project within a defined folder using the following Maven archetype:
Generating a project using Maven archetype
mvn archetype:generate \ -DarchetypeGroupId=org.kie \ -DarchetypeArtifactId=kie-kjar-archetype \ -DarchetypeVersion=7.52.0.Final-redhat-00007
This command generates a Maven project with required dependencies and generates required directories and files to build your business application. You can set up and use Git version-control system (recommended) when developing a project.
If you want to generate multiple projects in the same directory, you can specify the
artifactId
andgroupId
of the generated business application by adding-DgroupId=<groupid> -DartifactId=<artifactId>
to the previous command.- In your VSCode IDE, click File, select Open Folder, and navigate to the folder that is generated using the previous command.
Before creating the first asset, set a package for your business application, for example,
org.kie.businessapp
, and create respective directories in the following paths:-
PROJECT_HOME/src/main/java
-
PROJECT_HOME/src/main/resources
-
PROJECT_HOME/src/test/resources
For example, you can create
PROJECT_HOME/src/main/java/org/kie/businessapp
fororg.kie.businessapp
package.-
Use VSCode to create assets for your business application. You can create the assets supported by Red Hat Process Automation Manager VSCode extension using the following ways:
-
To create a business process, create a new file with
.bpmn
or.bpmn2
inPROJECT_HOME/src/main/java/org/kie/businessapp
directory, such asProcess.bpmn
. -
To create a DMN model, create a new file with
.dmn
inPROJECT_HOME/src/main/java/org/kie/businessapp
directory, such asAgeDecision.dmn
. -
To create a test scenario simulation model, create a new file with
.scesim
inPROJECT_HOME/src/main/java/org/kie/businessapp
directory, such asTestAgeScenario.scesim
.
-
To create a business process, create a new file with
After you create the assets in your Maven archetype, navigate to the root directory (contains
pom.xml
) of the project in the command line and run the following command to build the knowledge JAR (KJAR) of your project:mvn clean install
If the build fails, address any problems described in the command line error messages and try again to validate the project until the build is successful. However, if the build is successful, you can find the artifact of your business application in
PROJECT_HOME/target
directory.NoteUse
mvn clean install
command often to validate your project after each major change during development.
You can deploy the generated knowledge JAR (KJAR) of your business application on a running KIE Server using the REST API. For more information about using REST API, see Interacting with Red Hat Process Automation Manager using KIE APIs.