Chapter 3. Creating and executing DMN and BPMN models using Maven
Chapter 3. Creating and executing DMN and BPMN models using Maven You can use Maven archetypes to develop DMN and BPMN models in VS Code using the Red Hat Decision Manager VS Code extension instead of Business Central. You can then integrate your archetypes with your Red Hat Decision 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 Decision Manager VS Code extension. Procedure In a command terminal, navigate to a local folder where you want to store the new Red Hat Decision Manager project. Enter the following command to use a Maven archtype to generate a project within a defined folder: Generating a project using Maven archetype This command generates a Maven project with required dependencies and generates required directories and files to build your business application. You can use the Git version control system (recommended) when developing a project. If you want to generate multiple projects in the same directory, specify the artifactId and groupId of the generated business application by adding -DgroupId=<groupid> -DartifactId=<artifactId> to the command. In your VS Code IDE, click File , select Open Folder , and navigate to the folder that is generated using the 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 for org.kie.businessapp package. Use VS Code to create assets for your business application. You can create the assets supported by Red Hat Decision Manager VS Code extension using the following ways: To create a business process, create a new file with .bpmn or .bpmn2 in PROJECT_HOME/src/main/resources/org/kie/businessapp directory, such as Process.bpmn . To create a DMN model, create a new file with .dmn in PROJECT_HOME/src/main/resources/org/kie/businessapp directory, such as AgeDecision.dmn . To create a test scenario simulation model, create a new file with .scesim in PROJECT_HOME/src/test/resources/org/kie/businessapp directory, such as TestAgeScenario.scesim . 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: 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. Note Use 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 Decision Manager using KIE APIs .
mvn archetype:generate -DarchetypeGroupId=org.kie -DarchetypeArtifactId=kie-kjar-archetype -DarchetypeVersion=7.67.0.Final-redhat-00024 mvn clean install