Esteban's Blog


How to develop Drools Guvnor using NetBeans?

The idea of this post is to create a step by step tutorial on how to get Drools Guvnor running on NetBeans. As a NetBeans user (and Drools commiter), I wasn’t very happy using eclipse just because Guvnor was created using some GWT/Eclipse plugin. So I spent some time researching and finally came up with this tutorial.

I hope you find it useful, and of course, any feedback will be appreciated!

Let’s start!

Getting drools sources

We need to have a fresh checkout of drools sources. You can use your own working copy if you already have one, but I recommend to start with a clean checkout.

svn checkout drools_trunk

After the checkout ends (it could take some time), we have to compile the project. In order to do this we need to go to drools_trunk directory and run:

mvn clean install

If you don’t want to wait forever, you can omit the tests:

mvn -DskipTests clean install

Once the code is compiled we are ready to start working on guvnor. So please open your favorite IDE: NetBeans!

Setting up NetBeans IDE

Guvnor uses GWT framework. GWT is a toolkit that allows us to create RIA applications using pure Java code. It compiles client side java classes into html and javascript in a transparent way. It also handles all the communication between client and server sides.

When I started using Guvnor it was using 1.5.3 version of GWT. Thanks to Toni, that did an excellent (and hard) job, today  Guvnor is now using GWT version 2.0.3 !

So if we need to work with GWT it would be great if our IDE gives us some support. And guess what? There is a cool GWT plugin for NetBeans called gwt4nb that you can download from here. So, the first step would be to download the .nbm file and install it in Netbeans (right now I’m using version 2.6.21)

Now that we have the plugin installed let’s open drools-guvnor:

  1. File -> Open Project
  2. Browse to drools-guvnor folder. Be careful not to select the entire trunk directory when you are browsing your disk: if you do this, all drools projects are going to be openend in NetBeans. It is not wrong if you do this, but it will take some time.

If you get some errors in the tests packages don’t worry, this is because we didn’t compile the tests yet. You can Build the project to see that everything is working. If you have an error while compiling the project from NetBeans saying something about “Error executing external compiling” you will need to open the pom.xml file located in the trunk’s main directory and find the following section:


In that section you need to comment out the <fork> line.

Setting up Guvnor’s pom file

Ok, we are ready to start modifying Toni’s work to make Guvnor runs in NetBeans too. Let’s open the pom.xml file of Guvnor project.

In order to make Guvnor works in NetBeans, we need to modify this file. The first thing we need to add is the gwt-maven plugin: Add these lines in <build> section:


Note that I have commented the compile goal because I don’t want to compile GWT every time I compile Guvnor. I will compile GWT using the command line (or NetBeans too).

The next step is to add all the resources used by guvnor in the pom. Again in the <build> section we need to add these lines:


All these resources will be copied to guvnor when compiling. Maybe some of them are not necessary, I will be cleaning the pom in the future (when I understand it better 😉 )

Ok, so far so good. The original pom file declares a dependency on gwt-servlet, but not to gwt-user. I think this is because when you are using the eclipse gwt plugin you need to add the path to your GWT_HOME. Because we don’t want to use Eclipse, we need to add that dependency too. Maybe we can set some system variable instead of adding this dependency, but again… I don’t know.

The dependencies on gwt-servlet and gwt-user should be:


As you can see, we are using a variable to specify GWT version. You can replace it by 2.0.3 or add the following property:


We are almost finishing now. During compilation time I found an error related to JDT. It looks like I had the JDT compiler twice in my classpath. Thanks to NetBeans dependency Graph for maven project I found that drools-compiler was importing one of the repeated classes. So I had to exclude it from my pom:


The next problem I faced was related to Seam. What I had to do was to comment the dependency to org.jboss.seam/jboss-seam

So, that’s it. We are ready to run Guvnor using Netbeans! The final step is to compile GWT. I don’t know why, but the GWT compiled classes under target/drools-guvnor/org.drools.guvnor.Guvnor look like if they were compiled using GWT 1.5.3. What we need to do is to delete org.drools.guvnor.Guvnor and org.drools.guvnor.Guvnor-aux (if exists) and run:
mvn gwt:compile
You can also launch this goal using NetBeans. Depending on your system, the compilation could take a lot of time. And when I say “a lot” it means like 12 minutes. You can improve this time commenting the locales included in src/main/java/org/drools/guvnor/Guvnor.gwt.xml . In my particular case it takes 2:35 minutes without using the locales and 10:00 using them.

Creating our own maven action

We are going to use GWT hosted mode for development purpose, so we will configure a custom maven action in Netbeans.

To do this go to Guvnor project properties -> Actions and create a new “Hosted Mode” action. It should look like this:

"Hosted Mode" Action configuration

In the image you can see the goal we are using (gwt:debug) and the two properties that this goal needs: gwt.module and runTarget

Running Guvnor

To start guvnor in hosted mode we need to execute the recently created action: right click in the project -> Custom -> Hosted Mode.

This will start a Jetty server with Guvnor deployed on it. The server will be listening on port 8000 for debuggers.

So, what we need to do now is to attach a debugger there. Debug -> Attach Debugger… -> Ok (If the port is not configured, set it as 8000)

Attach a Debugger

This will open the GWT console in development Mode:

GWT Development Mode Console

And that’s it!! Open your favorite browser (only FF is supported in Linux :P) and copy the URL that appears in the GWT console. If this is your first time running a GWT app in hosted mode, you will be asked to install the Google Web Toolkit Developer Plugin. Install it, and voilà! You have Guvnor up and running!

Debugging and Modifying source code

Of course that we didn’t make all this work just to see Guvnor runs! We want to modify it, we want to debug it!

While running in hosted mode, you can add breakpoints whenever you want. They will be considered right away. Once in a breakpoint, you can use all the features that the rich NetBean’s debugger has.

When modifying code, the tasks needed to see the modifications in runtime  depends on what we have modified. If we have modified client side code, a simple refresh on the browser will be enough. But if the modified code runs on server side, we need to use the “Apply Code Changes” button on NetBeans and refresh our browser.  I know there is another way to do this, but I couldn’t make it work yet (Any help would be appreciated!).


It really took me some time to figure out all this steps. This is my first time using GWT so every step was a challenge for me. But I know that sometimes the best way to learn is to suffer :P.

What I did here is a step by step tutorial to left Guvnor running on NetBeans. My intention was to assist any other developer trying to achieve this goal. The steps described here is just the way I have found. I’m sure that other (and better) ways exists. That is also the aim of this post: to receive feedback from experienced Maven, GWT and NetBeans developers to improve my knowledge.

I hope you find this useful!


Here you will find all the links of the things used in this post:




drools svn:

My Guvnor pom.xml file:

Drools Homepage:

Plug Tree Homepage:


4 comments on “How to develop Drools Guvnor using NetBeans?

  1. Pingback: Tweets that mention How to develop Drools Guvnor using NetBeans? « Esteban's Blog --

  2. Nicolas Héron
    November 14, 2010

    does this still work with current trunk version
    Nicolas Héron

    • esteban
      November 15, 2010

      Unfortunately it doesn’t work with trunk. 😦
      I haven’t had time to make it work, but stay in touch for news.

  3. Pingback: How to develop Drools Guvnor using NetBeans? (via Esteban’s Blog) « Prayag Upd

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


This entry was posted on May 14, 2010 by in drools, java.
%d bloggers like this: