0
votes

I've developed a stand-alone drools application, with rules implemented via .drl files. I'm used the Eclipse IDE to develop the app. I want to embed this application in a web application using the tomcat web server package. I'd like to create a web app project in Eclipse and add the drools dependencies to the project, as needed. Which drools libraries/artifacts do I need to add to the project, e.g. kie and drools libraries/artifacts?

More specifically, if I create a maven-based web-app project using Eclipse. What other maven artifacts will I need to add to the POM for the drools capabilities?

The logic in the web application servlet will create a kie container and session, instantiate a set of Facts based on model definitions, insert the Facts into the session, fire the rules, and respond to the initial http request based on the results of rules evaluation.

1
Is your Eclipse project already a maven project? - Esteban Aliverti
@EstebanAliverti Sorry for the delayed response. I have created both web app and drools projects using Eclipse. I don't usually create Maven projects in Eclipse but I can do so if needed. I'm assuming that I would create a maven web app project and then add drools dependencies to the project. Thanks for your interest in my question. - R-WILL

1 Answers

0
votes

I resolved the question I posed above a while ago. I'm posting an answer to close the question. I came up with a set of maven dependencies that I used to create a java servlet application that initializes and invokes an embedded DROOLS rules engine to process an http request. I've successfully tested the servlet-based application within a Tomcat server (v8.5). I used the Eclipse IDE to create the application as a maven-based project. The pom.xml file for the application has the following dependencies.

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>javax.servlet.jsp</groupId>
  <artifactId>javax.servlet.jsp-api</artifactId>
  <version>2.3.1</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>org.glassfish.web</groupId>
  <artifactId>javax.servlet.jsp.jstl</artifactId>
  <version>1.2.4</version>
  <exclusions>
    <exclusion>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
    </exclusion>
    <exclusion>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.kie</groupId>
  <artifactId>kie-api</artifactId>
  <version>6.5.0.Final</version>
</dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-core</artifactId>
  <version>6.5.0.Final</version>
</dependency>
<dependency>
  <groupId>org.drools</groupId>
  <artifactId>drools-compiler</artifactId>
  <version>6.5.0.Final</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.8.5</version>
</dependency>
<dependency>
  <groupId>org.json</groupId>
  <artifactId>json</artifactId>
  <version>20180813</version>
</dependency>
<dependency>
  <groupId>commons-io</groupId>
  <artifactId>commons-io</artifactId>
  <version>2.6</version>
</dependency>