Desenvolupar Openbravo amb Eclipse

De Wikijoan
Dreceres ràpides: navegació, cerca

http://wiki.openbravo.com/wiki/Installation_and_setup_of_Eclipse_IDE

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

Contingut

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): https://dev.openbravo.com/websvn/openbravo/tags/r2.40/

$ 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): http://www.eclipse.org/downloads/

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: http://subclipse.tigris.org/update_1.4.x, 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:

-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-XX:MaxPermSize=128m

Secondly, download workbench.xml (http://wiki.openbravo.com/wiki/images/8/8a/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: https://dev.openbravo.com/websvn/openbravo
   * 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 https://dev.openbravo.com/svn/openbravo/ 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 https://dev.openbravo.com/svn/openbravo/tags/.

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.

Openbravo.properties file

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

Informació sobre el fitxer Openbravo.properties: http://wiki.openbravo.com/wiki/Openbravo.properties

El fitxer Openbravo.properties.template penja:

$ cp Openbravo.properties.template Openbravo.properties

Valors que canvio en el fitxer Openbravo.properties:

source.path=/home/joan/workspace/openbravo/openbravo
bbdd.rdbms=POSTGRE
bbdd.driver=org.postgresql.Driver
bbdd.url=jdbc:postgresql://localhost:5432
bbdd.sid=openbravo
bbdd.systemUser=postgres
bbdd.systemPassword=postgres
bbdd.user=tad
bbdd.password=tad
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 #
##################
#
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=admin
tomcat.manager.password=admin

Nota: en el meu cas, com que tinc el tomcat instal.lat 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

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

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

OpenbravoWAD

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

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.

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 instal.lat el Alfresco, i no me n'en fio. Aquesta pràctica l'he de provar amb una instal.lació neta del Tomcat.

Eines de l'usuari
Espais de noms
Variants
Accions
Navegació
IES Jaume Balmes
Màquines recreatives
CNC
Informàtica musical
joanillo.org Planet
Eines