In just five easy steps, you can integrate Drools into a new or existing project.
For starters, you will need to check that you have all of the required elements, listed as follows (all versions are as of time of writing):
Java 1.5 (or higher) SE JDK.
Apache Maven 3.0.4.
Eclipse 4.2 (Juno) and the Drools plugin.
Memory—512 MB (minimum), 1 GB or higher recommended. This will depend largely on the scale of your JVM and rule sessions, but the more the better!
Java is the core language on which Drools is built, and is the language in which we'll be writing, so we'll definitely be needing that. The easiest way to get Java going is to download from and follow the installation instructions found at:
Maven is a build automation tool from Apache that lets us describe a configuration of the project we're building and leave dependency management (amongst other things) up to it to work out. Again, the easiest way to get Maven up and running is to download and follow the documentation provided with the tool, found at:
If you happen to have some other IDE of choice, or maybe you're just the old school type, then it's perfectly acceptable to author and execute your Drools-integrated code in your usual fashion. However, if you're an Eclipse fan, or you'd like to take advantage of auto-complete, syntax highlighting, and debugging features, then I recommend you go ahead and install Eclipse and the Drools plugin.
The version of Eclipse that we're after is Eclipse IDE for Java Developers, which you can download and find installation instructions for on their site:
In order to add the IDE plugin to Eclipse, the easiest method is to use Eclipse's built-in update manager. First, you'll need to add something the plugin depends on—the Graphical Editing Framework (GEF).
In the Eclipse menu, click on Help, then on Install New Software..., enter the following URL in the Work with: field, and hit Add:
download.eclipse.org/tools/gef/updates/releases/
Give your repository a nifty name in the pop-up window, such as GEF, and continue on with the install as prompted. You'll be asked to verify what you're installing and accept the license.
Now we can add the Drools plugin itself—you can find the URL you'll need by visiting:
www.jboss.org/drools/downloads.html
Then, search for the text Eclipse update site
and you'll see the link you need. Copy the address of the link to your clipboard, head back into Eclipse, and follow the same process you did for installing GEF. Note that you'll be asked to confirm the install of unsigned content, and that this is expected.
By this point, you should be ready to integrate Drools into your applications. If you find yourself stuck, one of the good parts about an open source community is that there's nearly always someone who has faced your problem before and likely has a solution to recommend. Check towards the back of the book for a list of resources that can help get you going again!