Unlock 10% Discounts in 5 Minutes: Build a Drools Project with Maven

Jackson Williams - Oct 8 - - Dev Community

Building a Drools Project with Maven in 5 Easy Steps

In this tutorial, we will guide you through the process of creating a sample Drools project using Maven dependencies, eliminating the need for pre-configuring Drools in your Eclipse environment.

Our demo project will utilize Drools to determine the discount offered on various Bank Cards. For instance, if the user is employing an ABC Bankcard, we will provide a 10% discount. Follow the steps below to build the Maven Drools Project:

Step 1-2: Create a New Maven Project

Launch Eclipse and navigate to File -> New -> Project. A new window will open; search for Maven -> Maven Project. Click next until you reach the "Enter a group id for the artifact" page.

Step 3: Configure the Project

Enter the Artifact Id as "DroolsDemo", Group Id as "com.demo", and click Finish. After clicking Finish, the project will be created.

Step 4: Add Dependencies

Expand the project and open the pom.xml file. Under the dependencies tag, add the following dependency:

xml

org.drools
drools-compiler
6.0.1.Final

By following these easy steps, you can unlock 10% discounts and build a Drools project with Maven. For more information, visit computerstechnicians.

  • Proceed by creating a POJO class and deleting the default App.java file if present. Navigate to src/main/java, right-click on com.demo.DroolsDemo, and select New -> Class
  • Specify the class name as “CardDetails” and click Finishjava class creation
  • Insert the following code into the CardDetails class
package com.demo.DroolsDemo;

public class CardDetails {

. . . . . . . . . . . . . .
Terabox Video Player