이 콘텐츠는 선택한 언어로 제공되지 않습니다.
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
mvn io.quarkus:quarkus-maven-plugin:create \ -DprojectGroupId=org.acme -DprojectArtifactId=sample-kogito \ -DprojectVersion=1.0.0-SNAPSHOT -Dextensions=kogito-quarkus$ mvn io.quarkus:quarkus-maven-plugin:create \ -DprojectGroupId=org.acme -DprojectArtifactId=sample-kogito \ -DprojectVersion=1.0.0-SNAPSHOT -Dextensions=kogito-quarkusCopy to Clipboard Copied! Toggle word wrap Toggle overflow On Spring Boot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command generates a
sample-kogitoMaven 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.xmlfile in the Maven project that contains your Red Hat build of Kogito microservices:Dependency to enable PMML execution
Copy to Clipboard Copied! Toggle word wrap Toggle overflow On Red Hat build of Quarkus, if you plan to run your application on OpenShift, you must also import the
smallrye-healthextension for the liveness and readiness probes, as shown in the following example:SmallRye Health extension for Red Hat build of Quarkus applications on OpenShift
mvn quarkus:add-extension -Dextensions="smallrye-health"
$ mvn quarkus:add-extension -Dextensions="smallrye-health"Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command generates the following dependency in the
pom.xmlfile 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>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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
startersoraddonsproperty:To generate a project using the
startersproperty, enter the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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
addonsproperty, enter the following command:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteWhen you pass an add-on to the property, the add-on name does not require the
kogito-addons-springbootprefix. Also, you can combine theadd-onsandstartersproperties to customize the project.
- Open or import the project in your IDE to view the contents.