source: AgentMind/trunk/AgentMind/Drools Installation and Setup (Core and IDE).html @ 381

Revision 279, 36.3 KB checked in by myl, 11 years ago (diff)

Drools installation instruction

Line 
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html
3  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml"><head><title xmlns:rf="java:org.jboss.highlight.XhtmlRendererFactory">Chapter 3. Installation and Setup (Core and IDE)</title><link rel="stylesheet" href="css/jbossorg.css" type="text/css"/><meta xmlns:rf="java:org.jboss.highlight.XhtmlRendererFactory" name="generator" content="DocBook XSL-NS Stylesheets V1.74.0"/><link rel="home" href="index.html" title="Drools Introduction and General User Guide"/><link rel="up" href="index.html" title="Drools Introduction and General User Guide"/><link rel="prev" href="ch02.html" title="Chapter 2. Drools Release Notes"/><link rel="next" href="ix01.html" title="Index"/></head><body><p id="title"><a href="http://www.jboss.org" class="site_href"><strong>JBoss.org</strong></a><a href="http://docs.jboss.org/" class="doc_href"><strong>Community Documentation</strong></a></p><ul class="docnav"><li class="previous"><a accesskey="p" href="ch02.html"><strong>Prev</strong></a></li><li class="next"><a accesskey="n" href="ix01.html"><strong>Next</strong></a></li></ul><div class="chapter" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1322"/>Chapter 3. Installation and Setup (Core and IDE)</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch03.html#d0e1325">3.1. Installing and using</a></span></dt><dd><dl><dt><span class="section"><a href="ch03.html#d0e1337">3.1.1. Dependencies and jars</a></span></dt><dt><span class="section"><a href="ch03.html#d0e1366">3.1.2. Runtime</a></span></dt><dt><span class="section"><a href="ch03.html#d0e1371">3.1.3. Installing IDE (Rule Workbench)</a></span></dt></dl></dd><dt><span class="section"><a href="ch03.html#d0e1473">3.2. Setup from source</a></span></dt><dt><span class="section"><a href="ch03.html#d0e1532">3.3. Source Checkout</a></span></dt><dt><span class="section"><a href="ch03.html#d0e1583">3.4. Build</a></span></dt><dd><dl><dt><span class="section"><a href="ch03.html#d0e1586">3.4.1. Building the Source</a></span></dt><dt><span class="section"><a href="ch03.html#d0e1615">3.4.2. Building the Manual</a></span></dt></dl></dd><dt><span class="section"><a href="ch03.html#d0e1667">3.5. Eclipse</a></span></dt><dd><dl><dt><span class="section"><a href="ch03.html#d0e1670">3.5.1. Importing Eclipse Projects</a></span></dt></dl></dd></dl></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1325"/>3.1. Installing and using</h2></div></div></div><p>Drools provides an Eclipse-based IDE (which is optional), but at its
5  core only Java 1.5 (Java SE) is required.</p><p>A simple way to get started is to download and install the Eclipse
6  plug-in - this will also require the Eclipse GEF framework to be installed
7  (see below, if you don't have it installed already). This will provide you
8  with all the dependencies you need to get going: you can simply create a new
9  rule project and everything will be done for you. Refer to the chapter on
10  the Rule Workbench and IDE for detailed instructions on this. Installing the
11  Eclipse plug-in is generally as simple as unzipping a file into your Eclipse
12  plug-in directory.</p><p>Use of the Eclipse plug-in is not required. Rule files are just
13  textual input (or spreadsheets as the case may be) and the IDE (also known
14  as the Rule Workbench) is just a convenience. People have integrated the
15  rule engine in many ways, there is no "one size fits all".</p><p>Alternatively, you can download the binary distribution, and include
16  the relevant jars in your projects classpath.</p><p/><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1337"/>3.1.1. Dependencies and jars</h3></div></div></div><p>Drools is broken down into a few modules, some are required during
17    rule development/compiling, and some are required at runtime. In many
18    cases, people will simply want to include all the dependencies at runtime,
19    and this is fine. It allows you to have the most flexibility. However,
20    some may prefer to have their "runtime" stripped down to the bare minimum,
21    as they will be deploying rules in binary form - this is also possible.
22    The core runtime engine can be quite compact, and only require a few 100
23    kilobytes across 2 jar files.</p><p>The following is a description of the important libraries that make
24    up JBoss Rules</p><div class="itemizedlist"><ul><li><p>drools-api.jar - this provides the interfaces
25        and factories. Drools-api also helps clearly show what is intended
26        as a user api and what is just an engine api.</p></li><li><p>drools-core.jar - this is the core engine, runtime component.
27        Contains both the RETE engine and the LEAPS engine. This is the only
28        runtime dependency if you are pre-compiling rules (and deploying via
29        Package or RuleBase objects).</p></li><li><p>drools-compiler.jar - this contains the compiler/builder
30        components to take rule source, and build executable rule bases. This
31        is often a runtime dependency of your application, but it need not be
32        if you are pre-compiling your rules. This depends on
33        drools-core</p></li><li><p>drools-jsr94.jar - this is the JSR-94 compliant implementation,
34        this is essentially a layer over the drools-compiler component. Note
35        that due to the nature of the JSR-94 specification, not all features
36        are easily exposed via this interface. In some cases, it will be
37        easier to go direct to the Drools API, but in some environments the
38        JSR-94 is mandated.</p></li><li><p>drools-decisiontables.jar - this is the decision tables
39        'compiler' component, which uses the drools-compiler component. This
40        supports both excel and CSV input formats.</p></li></ul></div><p>There are quite a few other dependencies which the above components
41    require, most of which are for the drools-compiler, drools-jsr94 or
42    drools-decisiontables module. Some key ones to
43    note are "POI" which provides the
44    spreadsheet parsing ability, and "antlr" which provides the parsing for
45    the rule language itself.</p><p>NOTE: if you are using Drools in J2EE or servlet containers and you
46    come across classpath issues with "JDT", then you can switch to the janino
47    compiler. Set the system property "drools.compiler": For example:
48    -Ddrools.compiler=JANINO.</p><p>For up to date info on dependencies in a release, consult the
49    README_DEPENDENCIES.txt file, which can be found in the lib directory of
50    the download bundle, or in the root of the project directory.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1366"/>3.1.2. Runtime</h3></div></div></div><p>The "runtime" requirements mentioned here are if you are deploying
51    rules as their binary form (either as KnowledgePackage objects, or KnowledgeBase objects
52    etc). This is an optional feature that allows you to keep your runtime
53    very light. You may use drools-compiler to produce rule packages "out of
54    process", and then deploy them to a runtime system. This runtime system
55    only requires drools-core.jar and drools-api for execution. This is an optional
56    deployment pattern, and many people do not need to "trim" their
57    application this much, but it is an ideal option for certain
58    environments.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1371"/>3.1.3. Installing IDE (Rule Workbench)</h3></div></div></div><p>The rule workbench (for Eclipse) requires that you have Eclipse 3.4
59    or greater, as well as Eclipse GEF 3.4 or greater. You can install it
60    either by downloading the plug-in or, or using the update site.</p><p>Another option is to use the JBoss IDE, which comes with all the
61    plug-in requirements pre packaged, as well as a choice of other tools
62    separate to rules. You can choose just to install rules from the "bundle"
63    that JBoss IDE ships with.</p><div class="section" lang="en-US"><div class="titlepage"><div><div><h4 class="title"><a id="d0e1378"/>3.1.3.1. Installing GEF (a required dependency)</h4></div></div></div><p>GEF is the Eclipse Graphical Editing Framework, which is used for
64      graph viewing components in the plug-in.</p><p>If you don't have GEF installed, you can install it using the
65      built in update mechanism (or downloading GEF from the Eclipse.org
66      website not recommended). JBoss IDE has GEF already, as do many other "distributions" of
67      Eclipse, so this step may be redundant for some people.</p><p>Open the Help-&gt;Software updates...-&gt;Available Software-&gt;Add Site...
68      from the help menu. Location is:</p><pre class="programlisting">http://download.eclipse.org/tools/gef/updates/releases/</pre><p>Next you choose the GEF plug-in:</p><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/install_gef.png"/></div></div><p>Press next, and agree to install the plug-in (an Eclipse restart
69      may be required). Once this is completed, then you can continue on
70      installing the rules plug-in.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h4 class="title"><a id="d0e1397"/>3.1.3.2. Installing GEF from zip file</h4></div></div></div><p>To install from the zip file, download and unzip the file. Inside
71      the zip you will see a plug-in directory, and the plug-in jar itself. You
72      place the plug-in jar into your Eclipse applications plug-in directory,
73      and restart Eclipse.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h4 class="title"><a id="d0e1402"/>3.1.3.3. Installing Drools plug-in from zip file</h4></div></div></div><p>Download the Drools Eclipse
74    IDE plugin from the link below. Unzip the downloaded file in your main eclipse folder
75    (do not just copy the file there, extract it so that the feature and plugin jars end
76    up in the features and plugin directory of eclipse) and (re)start Eclipse.</p><p><a class="ulink" href="http://www.jboss.org/drools/downloads.html">http://www.jboss.org/drools/downloads.html</a></p><p>To check that the installation was successful, try opening the Drools perspective:
77    Click the 'Open Perspective' button in the top right corner of your Eclipse window,
78    select 'Other...' and pick the Drools perspective.  If you cannot find the Drools perspective
79    as one of the possible perspectives, the installation probably was unsuccessful. Check
80    whether you executed each of the required steps correctly: Do you have the right version
81    of Eclipse (3.4.x)?  Do you have Eclipse GEF installed (check whether the org.eclipse.gef_3.4.*.jar
82    exists in the plugins directory in your eclipse root folder)? Did you extract the Drools Eclipse
83    plugin correctly (check whether the org.drools.eclipse_*.jar exists in the plugins directory in
84    your eclipse root folder)?  If you cannot find the problem, try contacting us (e.g. on irc or on
85    the user mailing list), more info can be found no our homepage here:</p><p><a class="ulink" href="http://www.jboss.org/drools/">http://www.jboss.org/drools/</a></p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h4 class="title"><a id="d0e1415"/>3.1.3.4. Drools Runtimes</h4></div></div></div><p>A Drools runtime is a collection of jars on your file system that represent
86    one specific release of the Drools project jars. To create a runtime, you must
87    point the IDE to the release of your choice.  If you want to create a new runtime
88    based on the latest Drools project jars included in the plugin itself, you can also
89    easily do that.  You are required to specify a default Drools runtime for your
90    Eclipse workspace, but each individual project can override the default and select
91    the appropriate runtime for that project specifically.</p><div class="section" lang="en-US"><div class="titlepage"><div><div><h5 class="title"><a id="d0e1420"/>3.1.3.4.1. Defining a Drools runtime</h5></div></div></div><p>You are required to define one or more Drools runtimes using the Eclipse preferences
92      view.  To open up your preferences, in the menu Window select the Preferences
93      menu item.  A new preferences dialog should show all your preferences.  On the
94      left side of this dialog, under the Drools category, select "Installed Drools
95      runtimes".  The panel on the right should then show the currently defined Drools
96      runtimes.  If you have not yet defined any runtimes, it should like something like
97      the figure below.</p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes.png" align="middle"/></div><p>To define a new Drools runtime, click on the add button.  A dialog as shown
98      below should pop up, requiring the name for your runtime and the location on your
99      file system where it can be found.</p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes-add.png" align="middle"/></div><p>In general, you have two options:</p><div class="orderedlist"><ol type="1"><li><p>If you simply want to use the default jars as included in the Drools
100        Eclipse plugin, you can create a new Drools runtime automatically by clicking the
101        "Create a new Drools 5 runtime ..." button.  A file browser will show up, asking
102        you to select the folder on your file system where you want this runtime to be
103        created.  The plugin will then automatically copy all required dependencies to
104        the specified folder.  After selecting this folder, the dialog should look like
105        the figure shown below.</p></li><li><p>If you want to use one specific release of the Drools project, you should
106        create a folder on your file system that contains all the necessary Drools libraries
107        and dependencies.  Instead of creating a new Drools runtime as explained above, give
108        your runtime a name and select the location of this folder containing all the required
109        jars.</p></li></ol></div><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes-add2.png" align="middle"/></div><p>After clicking the OK button, the runtime should show up in your table of installed
110      Drools runtimes, as shown below.  Click on checkbox in front of the newly created runtime
111      to make it the default Drools runtime.  The default Drools runtime will be used as the
112      runtime of all your Drools project that have not selected a project-specific runtime.
113      </p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes2.png" align="middle"/></div><p>You can add as many Drools runtimes as you need.  For example, the screenshot below
114      shows a configuration where three runtimes have been defined: a Drools 4.0.7 runtime, a
115      Drools 5.0.0 runtime and a Drools 5.0.0.SNAPSHOT runtime.  The Drools 5.0.0 runtime is
116      selected as the default one.</p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes3.png" align="middle"/></div><p>Note that you will need to restart Eclipse if you changed the default runtime and
117      you want to make sure that all the projects that are using the default runtime update
118      their classpath accordingly.</p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h5 class="title"><a id="d0e1457"/>3.1.3.4.2. Selecting a runtime for your Drools project</h5></div></div></div><p>Whenever you create a Drools project (using the New Drools Project wizard or by
119      converting an existing Java project to a Drools project using the "Convert to Drools
120      Project" action that is shown when you are in the Drools perspective and you right-click
121      an existing Java project), the plugin will automatically add all the required jars to
122      the classpath of your project.</p><p>When creating a new Drools project, the plugin will automatically use the default
123      Drools runtime for that project, unless you specify a project-specific one.  You can do
124      this in the final step of the New Drools Project wizard, as shown below, by deselecting
125      the "Use default Drools runtime" checkbox and selecting the appropriate runtime in the
126      drop-down box.  If you click the "Configure workspace settings ..." link, the workspace
127      preferences showing the currently installed Drools runtimes will be opened, so you can
128      add new runtimes there.</p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes-newproject.png" align="middle"/></div><p>You can change the runtime of a Drools project at any time by opening the project
129      properties (right-click the project and select Properties) and selecting the Drools
130      category, as shown below.  Check the "Enable project specific settings" checkbox and select
131      the appropriate runtime from the drop-down box.  If you click the "Configure workspace
132      settings ..." link, the workspace preferences showing the currently installed Drools
133      runtimes will be opened, so you can add new runtimes there.  If you deselect the "Enable
134      project specific settings" checkbox, it will use the default runtime as defined in your
135      global preferences.</p><div class="mediaobject" align="center"><img src="images/Chapter-Install/drools-runtimes-project.png" align="middle"/></div></div></div></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1473"/>3.2. Setup from source</h2></div></div></div><p>As Drools is an open source project, instructions for building from
136  source are part of the manual ! Building from source means you can stay on
137  top with the latest features. Whilst aspects of Drools are quite
138  complicated, many users have found ways to become contributors.</p><p>Drools works with JDK1.5 and above. you will need also need to have
139  the following tools installed. Minimum requirement version numbers
140  provided.</p><div class="itemizedlist"><ul><li><p><a id="d0e1483" class="indexterm"/>Eclipse 3.4 </p><p>http://www.eclipse.org/</p></li><li><p><a id="d0e1491" class="indexterm"/>Subversion Client 1.4</p><p>http://subversion.tigris.org</p><p><a id="d0e1498" class="indexterm"/>http://tortoisesvn.tigris.org - recommended win32
141      client</p></li><li><p><a id="d0e1504" class="indexterm"/>Maven 2.0.9</p><p>http://maven.apache.org/</p></li><li><p><a id="d0e1512" class="indexterm"/>Ant 1.7.0</p><p>http://ant.apache.org</p></li></ul></div><p>Ensure the executables for ant, maven and java are in your <a id="d0e1520" class="indexterm"/>path. The examples given illustrative and are for a win32
142  system:</p><div class="literallayout"><p>Path=D:\java\j2sdk1.5.0_8\bin;D:\java\apache-ant-1.7\bin;D:\java\maven-2.0.9\bin</p></div><p>Following environment variables will also need to be set. The examples
143  given illustrative and are for a win32 system::</p><div class="literallayout"><p>JAVA_HOME=D:\java\j2sdk1.5.0_8<br/>
144ANT_HOME=D:\java\apache-ant-1.7<br/>
145MAVEN_HOME=D:\java\maven-2.0.9<br/>
146<br/>
147</p></div><p>
148                Past releases used to have an ant based build mechanism, but now maven is mandatory, although Ant is used internally in maven for document building proposes
149        </p></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1532"/>3.3. Source Checkout</h2></div></div></div><p>Drools is available from two <a id="d0e1537" class="indexterm"/>Subversion repositories.</p><div class="itemizedlist"><ul><li><p>Anonymous SVN</p><p>http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/</p></li><li><p>Developers secured SVN</p><p>https://svn.jboss.org/repos/labs/labs/jbossrules/trunk/</p></li></ul></div>
150
151To checkout Drools source code just execute the following command.
152
153<pre class="programlisting">fmeyer:~/jboss $ svn checkout http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/ trunk</pre>
154
155And wait to complete the files download.
156
157<pre class="programlisting">A    trunk/drools-repository
158A    trunk/drools-repository/.classpath
159A    trunk/drools-repository/.project
160A    trunk/drools-repository/doc
161A    trunk/drools-repository/doc/repository_layout.jpeg
162A    trunk/drools-repository/doc/high_level_design.jpeg
163A    trunk/drools-repository/doc/javadoc
164A    trunk/drools-repository/doc/javadoc/serialized-form.html
165A    trunk/drools-repository/doc/javadoc/index-all.html
166A    trunk/drools-repository/doc/javadoc/stylesheet.css
167A    trunk/drools-repository/doc/javadoc/allclasses-frame.html
168A    trunk/drools-repository/doc/javadoc/package-list
169A    trunk/drools-repository/doc/javadoc/overview-tree.html
170A    trunk/drools-repository/doc/javadoc/org
171A    trunk/drools-repository/doc/javadoc/org/drools
172A    trunk/drools-repository/doc/javadoc/org/drools/repository
173A    trunk/drools-repository/doc/javadoc/org/drools/repository/class-use
174A    trunk/drools-repository/doc/javadoc/org/drools/repository/class-use/RuleSet.html
175A    trunk/drools-repository/doc/javadoc/org/drools/repository/class-use/RulesRepositoryException.html
176A    trunk/drools-repository/doc/javadoc/org/drools/repository/class-use/RulesRepository.html
177A    trunk/drools-repository/doc/javadoc/org/drools/repository/RuleSet.html
178
179....
180
181snip
182
183....
184
185A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz
186A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz/waltz.drl
187A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners
188A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners/manners.drl
189A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb
190A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb/waltzdb.drl
191A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples
192A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicketWithDSL.drl
193A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/TroubleTicket.drl
194A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway
195A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/calculate.rfm
196A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/generation.rf
197A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/calculate.rf
198A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/registerNeighbor.rfm
199A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/killAll.rfm
200A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/registerNeighbor.rf
201A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-agendagroup.drl
202A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/killAll.rf
203A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-ruleflow.drl
204A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/generation.rfm
205A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/ticketing.dsl
206A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/StateExampleUsingSalience.drl
207A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/golf.drl
208A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/LogicalAssertionsNotPingPong.drl
209A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/StateExampleDynamicRule.drl
210A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/sudoku
211A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/sudoku/sudoku.drl
212A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HelloWorld.drl
213A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/ExamplePolicyPricing.xls
214A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HonestPolitician.drl
215A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/Fibonacci.drl
216A    trunk/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/StateExampleUsingAgendGroup.drl
217A    trunk/drools-examples/drools-examples-drl/pom.xml
218A    trunk/drools-examples/drools-examples-drl/build.xml
219 U   trunk
220Checked out revision 13656.</pre><p>Although, we highly recommend command line tools to work with repository you can also use both Eclipse's integrated SVN client or TortoiseSVN</p><p>Setup TortoiseSVN to checkout from the subversion repository and click
221  <code class="literal">'OK'</code> Once the checkout has finished you should see the
222  folders as shown below.</p><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/svn_checkout1.png"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/svn_checkout2.png"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/svn_checkout3.png"/></div></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1583"/>3.4. Build</h2></div></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1586"/>3.4.1. Building the Source</h3></div></div></div><p>Now that we have the source the next step is to build and install
223    the source. Since version 3.1 Drools uses Maven 2 to build the system. There are two profiles
224    available which enable the associated modules "documentation" and
225    "Eclipse"; this enables quicker building of the core modules for
226    developers. The Eclipse profile will download Eclipse into the
227    drools-Eclipse folder, which is over 100MB download (It depends on your operating system), however this only
228    needs to be done once; if you wish you can move that Eclipse download into
229    another location and specify it with
230    -DlocalEclipseDrop=/folder/jboss-drools/local-Eclipse-drop-mirror. The
231    following builds all the jars, the documentation and the Eclipse zip with
232    a local folder specified to avoid downloading Eclipse:</p><pre class="programlisting">mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-drools/local-Eclipse-drop-mirror </pre><p>You can produce distribution builds, which puts everything into
233    zips, as follows:
234</p><pre class="programlisting">mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-drools/local-Eclipse-drop-mirror
235mvn -Ddocumentation -Declipse -Dmaven.test.skip package javadoc:javadoc assembly:assembly -DlocalEclipseDrop=/folder/jboss-drools/local-Eclipse-drop-mirror
236</pre><p>Note that install must be done first as javadoc:javadoc won't work
237    unless the jars are in the local maven repo, but the tests can be skipped
238    on the second run. assembly:assembly fails unless you increase the
239    available memory to Maven, on windows the following command worked well:
240    set MAVEN_OPTS=-Xmx512m</p><p>Type mvn clean to clear old artifacts, and then test and built the
241    source, and report on any errors.</p><p>The resulting jars are put in the /target directory from the top
242    level of the project.</p><p>As maven builds each module it will install the resulting jars in
243    the local Maven 2 repository automatically. Where it can be easily used
244    from other project <code class="literal">pom.xml</code> or copied else where.</p><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/mvn_install4.png"/></div></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1615"/>3.4.2. Building the Manual</h3></div></div></div><p>
245                The building of the manual is now integrated into the maven build process, and is built by either using the profile (-Ddocumentation) switch or
246                cding into the main directory.
247        </p><p>Drools uses <a id="d0e1622" class="indexterm"/>Docbook for this manual. Maven is used to build documents and this build produces three different formats,
248      all sharing the same images directory.</p><div class="itemizedlist"><ul><li><p>html_single</p><p>The entire manual in a single html document</p></li><li><p><a id="d0e1634" class="indexterm"/>html</p><p>The manual is split into multiple documents and placed in a
249        frameset. The left frame provides navigation</p></li><li><p>Eclipse</p><p>Documentation suitable for including in an Eclipse plug-in</p></li></ul></div><p>The manual can be generated from the project pom.xml by
250    calling <code class="literal">'mvn package'</code> in the drools-docs directory or adding the -Ddocumentation switch when you build the sources.
251    Documentation is generated into each drools-docs subdirectory's <code class="literal">'target/'</code> directory. Running <code class="literal">'mvn -Ddocumentation package assembly:assembly'</code>
252    in the Drools project root generates and copies the documentation into a zip file. This zip file is located in the root folders <code class="literal">'target/'</code>
253    directory.
254
255    </p><pre class="programlisting">[trikkola@trikkola trunk]$ mvn -Ddocumentation clean package assembly:assembly
256[INFO] Scanning for projects...
257[INFO] Reactor build order:
258[INFO]   Drools
259[INFO]   Drools :: API
260[INFO]   Drools :: Core
261[INFO]   Drools :: Compiler
262[INFO]   Drools :: Templates
263[INFO]   Drools :: Decision Tables
264[INFO]   Drools :: JSR-94 API Module
265[INFO]   Drools :: Pipeline :: Transformer :: Smooks
266[INFO]   Drools :: Pipeline :: Transformer :: JAXB
267[INFO]   Drools :: Pipeline :: Transformer :: XStream
268[INFO]   Drools :: Pipeline :: Transformer :: JXLS
269[INFO]   Drools :: Pipeline :: Messenger :: JMS
270[INFO]   Drools :: Pipeline
271[INFO]   Drools :: Process :: WorkItems
272[INFO]   Drools :: Process :: Task
273[INFO]   Drools :: Process :: BAM
274[INFO]   Drools :: Process
275[INFO]   Drools :: Persistence :: JPA
276[INFO]   Drools :: Server
277[INFO]   Drools :: Verifier
278[INFO]   Drools :: Ant Task
279[INFO]   Drools :: Repository
280[INFO]   Drools :: Guvnor
281[INFO]   Drools :: Microcontainer
282[INFO]   Drools :: Clips
283[INFO]   Drools :: Solver parent
284[INFO]   Drools :: Solver core
285[INFO]   Drools :: Solver examples
286[INFO] Searching repository for plugin with prefix: 'assembly'.
287WAGON_VERSION: 1.0-beta-2
288[INFO] ------------------------------------------------------------------------
289[INFO] Building Drools
290[INFO]    task-segment: [clean, package]
291[INFO] ------------------------------------------------------------------------
292[INFO] [clean:clean]
293[INFO] [site:attach-descriptor]
294[INFO] Preparing source:jar
295[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
296[INFO] No goals needed for project - skipping
297[INFO] [source:jar {execution: default}]
298[INFO] Preparing source:test-jar
299[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
300[WARNING] Removing: test-jar from forked lifecycle, to prevent recursive invocation.
301[INFO] No goals needed for project - skipping
302[INFO] [source:test-jar {execution: default}]
303[INFO] ------------------------------------------------------------------------
304[INFO] Building Drools :: API
305[INFO]    task-segment: [clean, package]
306[INFO] ------------------------------------------------------------------------
307[INFO] [clean:clean]
308[INFO] Deleting directory /home/trikkola/jboss-drools/trunk/drools-api/target
309
310...snip ...
311
312[INFO]
313[INFO] ------------------------------------------------------------------------
314[INFO] Reactor Summary:
315[INFO] ------------------------------------------------------------------------
316[INFO] Drools ................................................ SUCCESS [59.889s]
317[INFO] Drools :: API ......................................... SUCCESS [4.832s]
318[INFO] Drools :: Core ........................................ SUCCESS [11.027s]
319[INFO] Drools :: Compiler .................................... SUCCESS [10.400s]
320[INFO] Drools :: Templates ................................... SUCCESS [1.018s]
321[INFO] Drools :: Decision Tables ............................. SUCCESS [1.179s]
322[INFO] Drools :: JSR-94 API Module ........................... SUCCESS [1.001s]
323[INFO] Drools :: Pipeline :: Transformer :: Smooks ........... SUCCESS [0.651s]
324[INFO] Drools :: Pipeline :: Transformer :: JAXB ............. SUCCESS [0.711s]
325[INFO] Drools :: Pipeline :: Transformer :: XStream .......... SUCCESS [0.465s]
326[INFO] Drools :: Pipeline :: Transformer :: JXLS ............. SUCCESS [0.481s]
327[INFO] Drools :: Pipeline :: Messenger :: JMS ................ SUCCESS [0.879s]
328[INFO] Drools :: Pipeline .................................... SUCCESS [0.006s]
329[INFO] Drools :: Process :: WorkItems ........................ SUCCESS [1.526s]
330[INFO] Drools :: Process :: Task ............................. SUCCESS [3.104s]
331[INFO] Drools :: Process :: BAM .............................. SUCCESS [0.580s]
332[INFO] Drools :: Process ..................................... SUCCESS [0.005s]
333[INFO] Drools :: Persistence :: JPA .......................... SUCCESS [0.958s]
334[INFO] Drools :: Server ...................................... SUCCESS [2.216s]
335[INFO] Drools :: Verifier .................................... SUCCESS [1.836s]
336[INFO] Drools :: Ant Task .................................... SUCCESS [0.722s]
337[INFO] Drools :: Repository .................................. SUCCESS [3.925s]
338[INFO] Drools :: Guvnor ...................................... SUCCESS [19.850s]
339[INFO] Drools :: Microcontainer .............................. SUCCESS [0.676s]
340[INFO] Drools :: Clips ....................................... SUCCESS [1.464s]
341[INFO] Drools :: Solver parent ............................... SUCCESS [0.527s]
342[INFO] Drools :: Solver core ................................. SUCCESS [2.209s]
343[INFO] Drools :: Solver examples ............................. SUCCESS [4.689s]
344[INFO] ------------------------------------------------------------------------
345[INFO] ------------------------------------------------------------------------
346[INFO] BUILD SUCCESSFUL
347[INFO] ------------------------------------------------------------------------
348[INFO] Total time: 2 minutes 24 seconds
349[INFO] Finished at: Tue Apr 07 15:11:14 EEST 2009
350[INFO] Final Memory: 48M/178M
351[INFO] ------------------------------------------------------------------------&gt;</pre><p>
352    </p><p>The generated manual can be found in the
353    <code class="literal">target\drools-docs$VERSION.jar'</code> file, a compressed archive with all formats.</p></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h2 class="title"><a id="d0e1667"/>3.5. Eclipse</h2></div></div></div><div class="section" lang="en-US"><div class="titlepage"><div><div><h3 class="title"><a id="d0e1670"/>3.5.1. Importing Eclipse Projects</h3></div></div></div><p>With the <a id="d0e1675" class="indexterm"/>Eclipse project files generated they can now be imported
354    into Eclipse. When starting Eclipse open the workspace in the root of your
355    subversion checkout.</p><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import1.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import2.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import3.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import4.jpg"/></div></div><p>When calling <code class="literal">'mvn install'</code> all the project
356    dependencies were downloaded and added to the local Maven repository.
357    Eclipse cannot find those dependencies unless you tell it where that
358    repository is. To do this setup an M2_REPO classpath variable.</p><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import6.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import7.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import8.jpg"/></div></div><div class="screenshot"><div class="mediaobject"><img src="images/Chapter-Install/eclipse_import9.jpg"/></div></div></div></div></div><ul class="docnav"><li class="previous"><a accesskey="p" href="ch02.html"><strong>Prev</strong>Chapter 2. Drools Release Notes</a></li><li class="up"><a accesskey="u" href="#"><strong>Top of page</strong></a></li><li class="home"><a accesskey="h" href="index.html"><strong>Front page</strong></a></li><li class="next"><a accesskey="n" href="ix01.html"><strong>Next</strong>Index</a></li></ul></body></html>
Note: See TracBrowser for help on using the repository browser.