How to create a new Maven Project based on drools-service-runner-archetype

 

Main objectives

 

  • Declare Rule Engine as a SOAP Service 
  • Scaffold really quickly an execution platform without writing glue code thanks to ChtiJBug API

Generate a new Maven project base on the Archetype

    • From a Terminal : run the following command (Feel free to replace groupId, artifactId, version and package of course)
mvn archetype:generate -DgroupId=org.chtijbug.drools -DartifactId=quickstart -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.chtijbug.drools -DarchetypeArtifactId=drools-service-runner-archetype -DarchetypeVersion=1.1.0.15 -DinteractiveMode=true

 

    • During the project generation, maven-archetype will ask for filling required inputs which are the following :  
      • guvnor-host : the base part of the URL where is located Guvnor (i.e. http://localhost:8080/
      • guvnor-app : the Guvnor Application name from the servlet container (i.e. drools-guvnor)
      • guvnor-package : The Business Assets package name within Guvnor
      • guvnor-version : the Business Assets Package version within Guvnor
      • guvnor-username : the account for accessing Guvnor REST API
      • guvnor-password : the account for accessing Guvnor REST API
      • decision-inputClass : The root Class which contains all elements to be inserted into the KnowledgeSession
      • decision-outputClass : The root Class which will be returned by the service.
      • warFilename : The final war name

 

Running Maven commands for building up the web application

  • Run the following commands from your terminal for building up the war file
1mvn clean
2mvn install

 

Deploy war file within any Servlet Containers (Apache Tomcat for instance)

  • The Archetype has a dependency to the maven-jetty-plugin, meaning the webapplication can simply be ran using the following command : 

 

mvn jetty:run -Xms256m -Xmx512m