3.5. Eclipse

3.5.1. Generating Eclipse Projects

The drools project has eclipse projects checked in for convenience. However, these are originally generated by maven 2. If you have maven 2 installed, you can also regenerate the eclipse projects automatically, or even generate it for IntelliJ etc, see the instructions below for this (most people can ignore this section)

Maven is able to generate standard Eclipse projects, but it is not able to generate Eclipse plugin projects. To generate the Eclipse projects for drools-core, drools-compiler and drools-jsr94 type 'mvn eclipse:eclipse'.

3.5.2. Importing Eclipse Projects

With the Eclispe project files generated they can now be imported into eclipse. When starting Eclipse open the workspace in the root of your subversion checkout.

When calling 'mvn install' all the project dependencies were downloaded and added to the local Maven repository. Eclipse cannot find those dependencies unless you tell it where that repository is. To do this setup an M2_REPO classpath variable.

3.5.3. Exporting the IDE Plugin

The drools-ide project was checked out out using subversion and is ready for exporting.

Once the plugin has been built open the output directory and copy the jar to the Eclipse plugin directory.

At this point if Eclipse is already open it will need to be restarted. At which point you show now see the new Drools menu icon and drl's should have icons and be provided with syntax highlighting and intellisense.

3.5.4. Building the update site

There is also an update site for the plug in. For developers who want to update the update site (ha) you will need to get to the update site project (or create a new one). They are kept in SVN, but in /jbossrules/update instead of /trunk. They are plain vanilla eclipse feature and site projects.

PLEASE REMEMBER that the plug in in the downloads directory, as a zip, should also be updated at the same time as the update site (as they are alternative ways ot getting the same plug in).

Eclipse refreshing plugins in features and sites seems to not work, so what is best is to manually edit the site.xml project and the feature.xml. To do this, open the site.xml file in the drools-ide-update project, it should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<site>
   <!-- change both the jar and the version number, make sure the new features jar is named
        the same as what you put in -->
   <feature url="features/org.drools.ide_1.0.2.jar" id="org.drools.ide" version="1.0.2">
  <category name="JBossRules"/>
   </feature>
   <category-def name="JBossRules" label="JBoss Rules"/>
</site>

Change the version attribute to be something new, and also the name of the feature jar to have a new version number at the end.

Go into the /feature directory, and unzip the feature jar to get to the feature.xml. (the feature jar really just contains the feature.xml). Open the feature.xml, and it should look like:

<?xml version="1.0" encoding="UTF-8"?>
<feature
  id="org.drools.ide"
  label="Drools Rule Workbench"
  version="1.0.2"> <!-- UPDATE THIS !! -->

   <description>
  JBoss Rules (Drools) Workbench for developers.
   </description>

   <copyright>
  Copyright 2005 JBoss Inc
   </copyright>

   <license>
  Licensed under the Apache License, Version 2.0(the &quot;License&quot;);
 you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
   http://www.apache.org/licenses/LICENSE-2.0
  
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
   </license>

   <plugin
 id="org.drools.ide"
 download-size="0"
 install-size="0"
 version="1.0.0"/> <!-- THIS JUST HAS TO BE CONSISTENT WITH THE PLUG IN -->

</feature>

Change the version number in the FEATURE tag to be the same as what you referred to in the site.xml. If you changed the version number of the main plug in, you will need to put the version number in the plug in tag (which refers to org.drools.ide plugin). Then zip up the feature.xml into a jar with the same name as you referred to in the site.xml.

Finally, drop the plugin jar into the /plugins jar directory of the update site (get the actual plug in from the exported plugin in the previous step). Now you can upload the site as is, and it will show up as a new version for Eclipse clients.