Chapter 3. Creating a Maven project for a Red Hat build of Kogito microservice Before you can begin developing Red Hat build of Kogito microservices, you need to create a Maven project where you can build your assets and any other related resources for your application. Procedure In a command terminal, navigate to a local folder where you want to store the new project. Enter the following command to generate a project within a defined folder: On Red Hat build of Quarkus On Spring Boot This command generates a sample-kogito Maven project and imports the extension for all required dependencies and configurations to prepare your application for business automation. If you want to enable PMML execution for your project, add the following dependency to the pom.xml file in the Maven project that contains your Red Hat build of Kogito microservices: Dependency to enable PMML execution <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-pmml</artifactId> </dependency> <dependency> <groupId>org.jpmml</groupId> <artifactId>pmml-model</artifactId> </dependency> On Red Hat build of Quarkus, if you plan to run your application on OpenShift, you must also import the smallrye-health extension for the liveness and readiness probes , as shown in the following example: SmallRye Health extension for Red Hat build of Quarkus applications on OpenShift This command generates the following dependency in the pom.xml file of your Red Hat Decision Manager project on Red Hat build of Quarkus: SmallRye Health dependency for Red Hat build of Quarkus applications on OpenShift <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> Open or import the project in your VS Code IDE to view the contents. 3.1. Creating a custom Spring Boot project for Red Hat build of Kogito microservices You can create custom Maven projects using the Spring Boot archetype for your Red Hat build of Kogito microservices. The Spring Boot archetype enables you to add Spring Boot starters or add-ons to your project. A Spring Boot starter is an all-in-one descriptor for your project and requires business automation engines provided by Red Hat build of Kogito. The Spring Boot starters include decisions, rules, and predictions. When your project contains all the assets and you want a quick way to get started with Red Hat build of Kogito, you can use the kogito-spring-boot-starter starter. For a more granular approach, you can use a specific starter, such as kogito-decisions-spring-boot-starter for decisions, or a combination of starters. Red Hat build of Kogito supports the following Spring Boot starters: Decisions Spring Boot starter Starter for providing DMN support to your Spring Boot project. The following is an example of adding a decisions Spring boot starter to your project: <dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-decisions-spring-boot-starter</artifactId> </dependency> </dependencies> Predictions Spring Boot starter Starter for providing PMML support to your Spring Boot project. The following is an example of adding a predictions Spring boot starter to your project: <dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-predictions-spring-boot-starter</artifactId> </dependency> </dependencies> Rules Spring Boot starter Starter for providing DRL support to your Spring Boot project. The following is an example of adding a rules Spring boot starter to your project: <dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-rules-spring-boot-starter</artifactId> </dependency> </dependencies> Procedure In a command terminal, navigate to a local folder where you want to store the new project. Enter one of the following commands to generate a project using the starters or addons property: To generate a project using the starters property, enter the following command: The new project includes the dependencies required to run the decision microservices. You can combine multiple Spring Boot starters using a comma-separated list, such as starters=decisions,rules . To generate a project containing Prometheus monitoring using the addons property, enter the following command: Note When you pass an add-on to the property, the add-on name does not require the kogito-addons-springboot prefix. Also, you can combine the add-ons and starters properties to customize the project. Open or import the project in your IDE to view the contents.

Commands:
mvn io.quarkus:quarkus-maven-plugin:create -DprojectGroupId=org.acme -DprojectArtifactId=sample-kogito -DprojectVersion=1.0.0-SNAPSHOT -Dextensions=kogito-quarkus
mvn archetype:generate -DarchetypeGroupId=org.kie.kogito -DarchetypeArtifactId=kogito-spring-boot-archetype -DgroupId=org.acme -DartifactId=sample-kogito -DarchetypeVersion=1.11.0.Final -Dversion=1.0-SNAPSHOT
<dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-pmml</artifactId> </dependency> <dependency> <groupId>org.jpmml</groupId> <artifactId>pmml-model</artifactId> </dependency>
mvn quarkus:add-extension -Dextensions="smallrye-health"
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>
<dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-decisions-spring-boot-starter</artifactId> </dependency> </dependencies>
<dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-predictions-spring-boot-starter</artifactId> </dependency> </dependencies>
<dependencies> <dependency> <groupId>org.kie.kogito</groupId> <artifactId>kogito-rules-spring-boot-starter</artifactId> </dependency> </dependencies>
mvn archetype:generate -DarchetypeGroupId=org.kie.kogito -DarchetypeArtifactId=kogito-springboot-archetype -DgroupId=org.acme -DartifactId=sample-kogito -DarchetypeVersion=1.11.0.Final -Dversion=1.0-SNAPSHOT -Dstarters=decisions
mvn archetype:generate -DarchetypeGroupId=org.kie.kogito -DarchetypeArtifactId=kogito-springboot-archetype -DgroupId=org.acme -DartifactId=sample-kogito -DarchetypeVersion=1.11.0.Final -Dversion=1.0-SNAPSHOT -Dstarters=descisions -Daddons=monitoring-prometheus,persistence-infinispan