Desenvolupar Openbravo amb Eclipse

De wikijoan
Salta a la navegació Salta a la cerca

Alguns dels avantatges d'utilitzar el Eclipse IDE per al desenvolupament d'Openbravo:

  • Code completion of all Openbravo ERP Java classes.
  • Error and warning detection before actual Ant build.
  • Quick and easy navigation between packages and methods.
  • Real-time debugging.
  • Java compilation on individual class level.
  • With a little effort, a lightning fast deployment of changes to Tomcat without any builds or restarts.

Preparant l'entorn

Client de Subversion

$ sudo apt-get install subversion

Necessitarem el Subversion perquè compilarem a partir de les fonts, del projecte troncal (trunk):

$ svn help
uso: svn <subcomando> [opciones] [pars]
Cliente Subversion de línea de comandos, versión 1.5.1.

Tinc instal.lada la versió 1.5, que és la que em diu el manual que s'ha d'instal.lar

XML processors

Download stax-api-1.0.1.jar (StAX) and wstx-asl-3.0.2.jar (Woodstox) XML processors. Then, copy these two files to lib folder inside your Ant fold

$ sudo cp stax-api-1.0.1.jar /opt/apache-ant-1.7.1/lib/
$ sudo cp wstx-asl-3.0.2.jar /opt/apache-ant-1.7.1/lib/

Eclipse IDE

Download Eclipse Ganymede IDE for Java EE Developers (Eclipse 3.4, 163 MB):

Descomprimir el Eclipse a /home/joan/eclipse, i crear un workspace a /home/joan/workspaces/openbravo

$ cd /home/joan/eclipse
$ ./eclipse

Puc tenir diferents projectes actius (per ex, diferents versions del Openbravo), i canviar entre ells fent File > Switch Workspace.

Subversive Plug-in

Current version of Subversive plug-in (0.7.2) is not full Subversion 1.5 capable so you will not be able to commit Openbravo repositories with it. Please use Subclipse plug-in instead.

Help > Software Updates and then the Available Software tab

click add site and enter the following url:, and click Install

Before getting started

Important note: this step needs Eclipse IDE to be closed.

Editem el fitxer eclipse.ini. Per a una màquina amb 1GB de RAM:


Secondly, download workbench.xml ( file and copy it inside your_worspace_path/.metadata/.plugins/org.eclipse.ui.workbench folder, overwriting existing one (please notice that .metadata folder could be hidden, and that you have to change the name Workbench.xml to lowercase workbench.xml).

This step will configure your Eclipse IDE workbench, that is, the set of editors and views used during a development.

Important note: you will have to repeat this step and the following ones for each of your new workspaces.

Eclipse workspace

obrim el Eclipse IDE

Instal.lem les preferències contingudes en el fitxer openbravo-eclipse-prefs_235_240.epf (Openbravo 2.35/2.40), tal com s'explica a la guia.

Copy stax-api-1.0.1.jar and wstx-asl-3.0.2.jar files from Ant lib folder to Eclipse IDE lib folder (usually eclipse/plugins/org.apache.ant/lib/). Then, go to Eclipse IDE Window > Preferences... menu element and select Ant > Runtime > Ant Home Entries (Default). Click on Add External JARs... button and add stax-api-1.0.1.jar and wstx-asl-3.0.2.jar.

Click on Window > Preferences.... Click on Team > SVN then select SVN Kit as SVN Connector (if you do not see SVN item in the menu you probably did not install Subclipse plug-in)

Click on Window > Preferences... then on Team > SVN > Label Decorations. In Text Decorations tab you can append useful information such as Revision and Author to files, folders and projects.

Click on Window > Preferences... then on Java > Compiler. Please make sure that 1.6 is selected in Compiler compliance level drop-down list.

Associate special file types to a XML editor. Click on General > Content Types then select Text > XML. Then click on Add... button (bottom right) and type *.xsql in File type text box. Repeat these steps to associate *.jrxml and *.fo files to the default XML editor.

In order to avoid file encoding issues, set your Text file encoding to UTF-8 and your New text file line delimiter to UNIX inside Window > Preferences > General > Workspace.

Checking out Openbravo ERP source code

Here we go! By checking out trunk source code from Openbravo Subversion (SVN) repository you will be able to:

   * Work with the last Openbravo ERP development source code and update it easily:
   * Commit your bug fixes or new developments to Openbravo SVN repository. See how to obtain write access to Openbravo SVN repository. 

To download Openbravo ERP trunk files into your empty workspace:

Click on File > New > Other.... In New pop-up window, select SVN > Projects from SVN and click on Next button.

Create a new repository location. In General tab, type in URL text box and check Validate Repository Location on finish check box. If you want to check out the last stable source code tag of Openbravo ERP, type

In Advanced tab, uncheck Enable Structure Detection check box and click on Next button.

When repository location validation finishes, select trunk folder then click on Finish button. If you want to check out the last stable source code tag of Openbravo ERP, select tag folder then r2.40 folder.

In Check Out As window, select Check out as a project with the name specified radio button, type openbravo as project name, check Checkout recursively check box then click on Next button. Do not use a project name different from openbravo otherwise you will experience odd behaviours. A bug has been reported at this subject.

Openbravo ERP source code check out starts. This process may take a while, depending on the speed of your Internet connection.

Once check out finishes, you will see in your Project Explorer tab a new project named openbravo followed by a revision number.

Important note: Problems tab may display errors. Do not mind of them since they will disappear once Openbravo ERP is totally compiled and built. file

Values of Openbravo environment variables need to be configured within file.

Informació sobre el fitxer

El fitxer penja:

  • en el IDE, de Openbravo [Trunk] > Java Resources > Config. S'ha d'editar amb els valors correctes, guardar-lo i refrescar (F5)
  • en la ruta, de ~/workspace/openbravo/openbravo/config
$ cp

Valors que canvio en el fitxer

bbdd.sessionConfig=select update_dateFormat('DD-MM-YYYY')

application.version=2.50 -> fixem-nos que és el codi font del trunk, i per tant és la versió 2.50

# Tomcat manager #

Nota: en el meu cas, com que tinc el tomcat de l'Alfresco, el contextname manager no el tinc, i això no sé si tindrà implicacions negatives...

Importing Openbravo ERP projects

The following projects are needed into your workspace before compiling: openbravo, OpenbravoCore, OpenbravoWAD and OpenbravoTrl. Please note that the order of importing projects must follow the sequence below.


openbravo project contains Openbravo ERP itself: forms, reports, call-outs, combos, processes and so on.

Please notice that, in the case that you checked out the source code from the Subversion repository using Eclipse IDE, openbravo project does not need to be imported.


OpenbravoCore project contains the core components: XmlEngine (View), SQLC (Model), HttpBaseServlet (Controller) and ConnectionPool.

  • Go to File > Import... menu item.
  • In Import pop-window, select General > Existing Projects into Workspace then click on Next button.
  • Browse to src-core folder in your project's folder then click on OK button. Check that OpenbravoCore project is selected then click on Finish button
  • Notice that OpenbravoCore project has been added to your Project Explorer tab.


OpenbravoWAD project contains the source code of the Wizard of Application Dictionary (WAD).

Follow the same steps as in OpenbravoCore to import OpenbravoWAD project from src-wad folder.

Important note: in case that you have errors regarding ConnectionProvider class, open the lib properties of OpenbravoWAD and include the openbravo-core.jar.

em dóna un error: Project 'OpenbravoWAD' is missing required source folder: 'build/javasqlc/src'

De moment no faig cas a aquest error


OpenbravoTrl project contains the source code of the translator.

Follow the same steps as in OpenbravoCore to import OpenbravoTrl project from src-trl folder.

El mateix problema: Project 'OpenbravoTrl' is missing required source folder: 'build/javasqlc/src'

De moment no faig cas a aquest error

Defining Tomcat server

Once all projects have been properly imported, it is time to define an Apache Tomcat server within Eclipse IDE.

Handling Tomcat through Eclipse IDE is a much more comfortable and rapid way of seeing changes made during development. In fact, there is no need to deploy openbravo context to the typical Tomcat webapps folder. Following these simple steps, a folder named tomcat containing configuration, logs and context files will be created inside your workspace.

  • In Servers tab, right click then select New > Server.
  • In New Server pop-up window, select Apache > Tomcat v6.0 Server then click on Next button.
  • Browse to your Tomcat installation directory to fill the corresponding text box.
  • Select openbravo from Available projects list then click on Add button.
  • Once openbravo project is moved to Configured projects list, click on Finish button.
  • Tomcat v6.0 Server is now available in Servers tab.
  • Right click on it then select Open.

Tinc un problema que em diu: The Tomcat installation directory is not valid. It is missing expected file or folder lib/jasper-el.jar.

I és que el meu tomcat l'ha el Alfresco, i no me n'en fio. Aquesta pràctica l'he de provar amb una instal.lació neta del Tomcat.