View source | Discuss page | Page history | Printable version   
ADVERTISEMENT
Accounting eLearning Courses
Partnerships
SourceForge.net Logo
Openbravo ERP at SourceForge

SourceForge.net Logo
Openbravo POS at SourceForge

Open Solution Alliance Logo
Openbravo at Open Solutions Alliance

Archive:Installation and setup of Eclipse IDE

Rating :
5.00/5
(3 votes cast)
You have to be registered to be able to vote

Contents

Introduction

This article is a step-by-step guide to install and setup Eclipse Integrated Development Environment (IDE) for Openbravo ERP development.

"Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the life cycle. A large and vibrant ecosystem of major technology vendors, innovative start-ups, universities, research institutions and individuals extend, complement and support the Eclipse platform.", according to Eclipse's community. For more general or technical information concerning Eclipse IDE, please visit:

Some of the major advantages of using Eclipse IDE for Openbravo ERP development are:

Openbravo ERP's source code is ready to work with Eclipse's IDE projects schema.


Minimum requirements

First, it is important to set up the environment in which Openbravo ERP works correctly, i.e.:

In addition a system with a minimum of 1GB of memory is required.

Subversion client

Install Subversion 1.5 (SVN 1.5) version control system client. Select the specific project package for your operating system.

Mercurial

Install and configure Mercurial in your operating system.

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 folder.


Eclipse IDE

Download Eclipse Ganymede IDE for Java EE Developers (Eclipse 3.4).

Installing Eclipse IDE amounts to uncompressing the files into a folder of your choosing.

Open Eclipse IDE and create a new workspace by typing where in your hard-drive you want this workspace to be created.

Important notes:

  • Avoid blank spaces in Workspace path.
  • Make sure that you have read and write access to Workspace path.

Important note: if you want to check out another Openbravo ERP source code to your machine apart from trunk one (e.g., r2.40 tag source code), just create a new workspace through File > Switch Workspace > Other.... Switch among your workspaces just by selecting File > Switch Workspace.

Subversive

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.

If you had install Subversive plug-in, Please follow these steps to uninstall it or watch it on-line: go to Help > Software Updates directly.

You will have to uninstall (in this order):

Mercurial Eclipse

Install Mercurial Eclipse plug-in.

Additional Plugins

Next to the standard Eclipse IDE one additional plugin is required for developing Openbravo:

If you plan to change the code generation templates of the Openbravo business objects then also the following plugin should be installed:

If you don't plan to change code generation templates then this plugin should not be installed.

These can be installed as follows: Help > Software Updates and then the Available Software tab. Here you can add a so-called update site from which the new plugins can be installed. Add the new site for subclipse (the one for openarchitectureware is already there), click add site and enter the following url: http://subclipse.tigris.org/update_1.4.x

Then select the subclipse tree and, if relevant, the openarchitectureware tree:

Image:update_manager.jpg

and click the install button. Eclipse should now be downloading the required plugins, choose the default options (next, accept license etc.). After downloading restart Eclipse.

Before getting started

Before getting started, please follow these few tips to configure properly Eclipse IDE for Openbravo ERP development.

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

First of all, tune Eclipse IDE performance and avoid OutOfMemoryExceptions problems by editing and overwriting eclipse.ini file (inside Eclipse installation directory) with the following lines:

-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
-showsplash
org.eclipse.platform
-framework
plugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m
-XX:MaxPermSize=256m 


Eclipse workbench

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

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

The next step is to set the standard preferences used in developing Openbravo. Open Eclipse IDE and access your workspace.


This step will configure some preferences for effective Openbravo ERP development using Eclipse IDE. Note: when restarting Eclipse the workspace has to be selected again in the workspace dialog (shown when starting Eclipse). You can also set the preferences manually, see Eclipse Preferences section below.

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... then on Validation. Un-check Allow projects to override these preference settings and check Suspend all validators check boxes.



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.



More information on Eclipse IDE workspace configuration:

Checking out Openbravo ERP source code

Mercurial

To be properly documented. By the moment follow Mercurial Manual for Openbravo developers guide.

Subversion

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

Important notes:

To download Openbravo ERP trunk files into your empty workspace:

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.

Important note: if you are using a 2.3x version of Openbravo ERP (e.g., tag r2.35 MP5), you still need to configure build.xml, XmlPool.xml and dbCon5.xml files apart from Openbravo.properties file. For this purpose, move to the root directory of your application and, using command line, type:

ant -f build.xml.template setup

This command will open an assistant that will ask you for environment variables.

Important notes:

  • Before going on, open Openbravo.properties file and make sure that all the variables hold the correct values. If not, you can edit them manually using Eclipse IDE.
  • If you selected a context name different from openbravo (e.g., openbravotrunk), right click on openbravo project and select Properties option. In Properties for openbravo pop-up window, select Web Project Settings, type your Context Root name then click on OK button.


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.

Otherwise, if you obtained Openbravo ERP source code checking it out via command line SVN or Tortoise SVN or via the Bitrock installer, follow the same steps as in OpenbravoCore to import openbravo project from openbravo folder.

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.

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.

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.

-vmargs -Xmx512M -XX:PermSize=64M -XX:MaxPermSize=512M

More information and common issues on Tomcat integration within Eclipse IDE can be found at Eclipse's Wiki.

Compiling and building Openbravo ERP

It is time to compile and build Openbravo ERP using Eclipse IDE! :)

Checks before the compilation and build

org.eclipse.wst.common.component file was available in the repository before ERP 2.50, but now is no longer available. Is generated during the setup process (the same setup process for Openbravo.properties file generation) in ERP 2.50 or later. org.eclipse.wst.common.component file make sure the deploy path of all web resources. It should be configurable. So that we can configure many resource paths in future. It make sure the set of files need to be copied from various places to WebContent to access the application in the development environment during the build purpose. The content of org.eclipse.wst.common.component file will be minimal for generic purpose in .settings folder as default. We can copy the content from org.eclipse.wst.common.component.template file to org.eclipse.wst.common.component file for our development environment purpose.

Initial content of org.eclipse.wst.common.component file:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId"/>

Content of org.eclipse.wst.common.component after copied from org.eclipse.wst.common.component.template file:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="openbravo">
<wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/srcAD"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/build/javasqlc/srcAD"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/build/javasqlc/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src-gen"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src-test"/>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/OpenbravoCore/OpenbravoCore">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="build/classes"/>
<property name="context-root" value="openbravo"/>
</wb-module>
</project-modules> 

Before starting the compilation and building of Openbravo ERP, please make the following checks:




Important note: when running an Ant task from the Eclipse external tools menu then the following error can occur: The environment variable JAVA_HOME is not set. To solve this, check out this page Environment Installation and follow the guidelines for setting JAVA_HOME in your specific environment. Restart Eclipse after setting JAVA_HOME.

Eclipse IDE compilation and build specifics

Openbravo ERP compilation using Eclipse IDE differs from command line method in one major aspect. Using Eclipse IDE, projects need:

  1. First to be compiled, obtaining *.java files inside build/javasqlc folder.
  2. Then built, obtaining *.class files inside build/classes folder.

Using command line, compilation and build happen in a single step.


There are two ways to compile and build Openbravo ERP using Eclipse IDE:

  1. In a single step by using eclipse.install.source Ant task.
  2. Component by component in the following order:
    1. OpenbravoCore project.
    2. The database.
    3. OpenbravoWAD project.
    4. OpenbravoTrl project.
    5. openbravo project.

eclipse.install.source

By launching eclipse.install.source Ant task, the database will be created and OpenbravoCore, OpenbravoWAD, OpenbravoTrl and openbravo projects will be built.

OpenbravoCore

Database

First step of Openbravo ERP building is the creation of the database from *.xml files.

OpenbravoWAD

OpenbravoTrl

openbravo

Compilation and build issues

Issue 1

Openbravo ERP compilation tasks for Eclipse IDE have been changed recently. If you are using a source code prior to revision 6192 (e.g., Openbravo ERP 2.35 MP5 or Openbravo ERP 2.40 beta), perform after each compilation tasks:


Issue 2

Before going on, please make sure that no errors remain in Problems tab.



Issue 3

If errors still remain (do not care about warnings), you will have to delete and import the project in error, compile and build Openbravo ERP or define Tomcat server again depending on the error message.


Issue 4

If you put your development environment ID inside Openbravo.properties file, please check that all is right by running the following SQL script in your database administration tool (e.g., pgAdmin III or phpPgAdmin for PostgreSQL and Oracle SQL Developer or Toad for Oracle):

SELECT CURRENTNEXTSYS FROM AD_SEQUENCE WHERE NAME='AD_Column';

Result must equal your development environment ID multiplied by 100.000 (one hundred thousands). If it does not, correct development.environment.id variable value inside Openbravo.properties file and run create.database Ant task again.

Running Openbravo ERP

Once Openbravo ERP has been properly compiled and built, it is ready to be used via your web browser.

Important notes:

  • Error HTTP Status 404 - File not found page instead of Login page reveals a problem with context name. Please make sure that Context Root in Project > Properties > Web project Settings has the same value that context.name variable in Openbravo.properties file.
  • Error HTTP Status 404 - Servlet X8006xx is not available page instead of Login page reveals a problem during compilation and build of Openbravo ERP. Please perform carefully these steps again before going on.

Important note: please notice that first log in is done with System Administrator role so you will not be able to see business options (message AccessTableNoView will display instead) but only administration tasks. In order to access business partners, products, sales and procurement orders and so on, change your role to BigBazaar Admin (or Openbravo Admin) by clicking on Openbravo link (left up) image:ChangeRole1.png and selecting it in Role infomation pop-up window. You can also set this role as default by checking Set as default check box.

Debugging Openbravo ERP

With the Eclipse IDE, one can easily debug the Java code within Openbravo ERP. A brief introduction is presented in this guide:

Note: Make sure that Eclipse actually has access to the source code of the method you want to step into.

Please find more information on how to debug *.java files within Eclipse IDE following:


Eclipse Preferences

This section describes which preferences to set in eclipse to get maximum performance/productivity and to ensure that you as a developer conform to Openbravo standards. These preferences can be set by downloading and importing this file openbravo-eclipse-prefs.epf, or can be set manually (as described in this section).

To set the Eclipse preferences go to Window > Preferences

Formatting: Java Conventions

This is a must-do. Set the code formatter to use the Java conventions.

Image:pref_formatter.jpg

Editor Save Actions

Eclipse is able to perform automatic actions when saving source files. One of the actions is formatting the source code and organizing imports. This is an important Must-Do. Set the save action as outlined below:

Image:pref_save.jpg

So check "perform the selected actions..." and then Format Source Code, Organize Imports and Additional Actions. Then in additional college essay actions click configure and go to code style tab and change the variable declarations section to set the modifier final for local variables (and uncheck private fields).

Disable Validation

Eclipse automatically validates xml, jsp and html files. Although this can be a usefull feature it is very resource intensive. The Openbravo development project has many xml and html files which makes it impossible to use this feature in automatic build mode. Disabling this feature makes it possible to work with Openbravo in automatic build mode. The validation can be disabled in the Validation preferences (in the bottom of the preferences view). Disable all automatic validation by unchecking the relevant checkbox.

Image:pref_validation.jpg

Compiler settings

Eclipse can automatically detect and flag potential programming problems. This is defined in the Java > Compiler > Errors/Warnings section. The standard settings are mostly okay but set the following errors/warning condition to Warning (from Ignore):

Developing Openbravo ERP

Development using Eclipse IDE follows the same principles as command line development of Openbravo ERP. Please find more information about Openbravo ERP development at:


Tips and Shortcuts

Build Problems

Eclipse will display compile and other problems in the Problems view. There is one problem which is important to keep in mind when working with eclipse, that's the build path problem. A build path problem is made visible in the Problem view but has as consequence that eclipse will not compile the classes. So any change you make is not visible in the runnable code. This is not directly obvious when you change your code and debug and then notice that the debugger is not insync with your source code. So if you encounter the situation that your source changes are not reflected when running eclipse then check

Image:buildpath.jpg

Search Type: Shift-Ctrl T

A very handy feature is to search for a type using its name. Open the search window by pressing the keys shift-ctrl-t at the same time. Note that this feature is available in the java and java EE perspectives.

Image:search_type.jpg

Breadcrumb

The breadcrumb feature (enabled through the breadcrumb button in the top) allows you to see where a file is located in the project. This is very handy when you open a file as part of a search action (so not by browsing the explorer tree).

Image:bread3.jpg

Breakpoint expressions

You can set breakpoints by right-clicking in the left of the source (when opened in the editor). A nice feature is that you can make the breakpoint conditional by entering a boolean expression in the breakpoint properties. The expression editor is context aware and has support for code completion. Note that setting the breakpoint condition has a fair amount of impact on the performance of the debug session.

Image:breakpoint.jpg

Open type (f3)

You can open a type (a class) or go to its declaration by setting the cursor on the variable or the declaration and pressing f3 or ctrl-left-mouseclick.

Call Hierarchy, type hierarchy etc.

Right clicking on a declaration or class allows you to see the call and type hierarchy and other usefull information.

Image:right_click.jpg

Known issues

Here is a list of known issues with Openbravo ERP and Eclipse IDE:


Support

For any question or doubt regarding Eclipse IDE installation and setup, post them in Openbravo Developers forum or join #openbravo IRC channel in Freenode.

Retrieved from "http://wiki.openbravo.com/wiki/Archive:Installation_and_setup_of_Eclipse_IDE"

This page has been accessed 79,111 times. This page was last modified 05:38, 4 March 2010. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.