Drools Project - NeverGiveUp143/Drools GitHub Wiki
Here we are going to build a sample Drools project using maven dependencies, and this will not require any pre-setup of drools in your eclipse to build the project.
In the sample demo project, we will be creating a Maven Project in which with the help of drools we will decide what discount is to be offered on which Bank Card
So let's follow the below steps to build the Maven Drools Project
Open the eclipse and go to File -> New -> Project
One window will open search for Maven -> Maven Project
Click next until you get the “Enter a group id for the artifact.” Page
Enter Artifact Id as “DroolsDemo”, Group Id as “com.demo” and click Finish
After clicking on Finish project will be created. Now, Expand the project and open the pom.xml
Under the dependencies tag, add below dependency
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>6.0.1.Final</version>
</dependency>
Create a Java class
Create a folder resources/META-INF/rules add a drl file in it
add Kmodule.xml inside META-INF folder the Kmodule.xml is used to read the drl file
add the below code in your main application.java
and run the application. Below is the Output
Below is the GitHub link to code
https://github.com/NeverGiveUp143/Drools/tree/WorkingExample/SampleProject