37
ERP/2.50/Developers Guide/Installation and setup of Eclipse IDE Contents 1 Introduction 2 Minimum requirements 2.1 Mercurial 2.2 XML processors 2.3 Eclipse IDE 2.4 Mercurial Eclipse 3 Before getting started 3.1 Eclipse workbench 3.2 Eclipse workspace 4 Checking out Openbravo ERP source code 4.1 Mercurial 4.2 Subversion 5 Openbravo.properties file 6 Importing Openbravo ERP projects 6.1 openbravo 6.2 OpenbravoCore 6.3 OpenbravoWAD 6.4 OpenbravoTrl 7 Defining Tomcat server 8 Compiling and building Openbravo ERP 8.1 Checks before the compilation and build 8.2 Eclipse IDE compilation and build specifics 8.3 eclipse.install.source 8.4 OpenbravoCore 8.5 Database 8.6 OpenbravoWAD 8.7 OpenbravoTrl 8.8 openbravo 8.9 Compilation and build issues 9 Running Openbravo ERP 10 Debugging Openbravo ERP 11 Eclipse Preferences 11.1 Formatting: Java Conventions 11.2 Editor Save Actions 11.3 Disable Validation 11.4 Compiler settings 12 Developing Openbravo ERP 13 Tips and Shortcuts 13.1 Build Problems 13.2 Build Path Problems: Common Causes and Solutions 13.2.1 Build ant task failed, did not copy the jar files to the WEB-INF/lib directory 13.2.2 Development project linked to wrong/non-existent Tomcat Server or not linked to a Tomcat server at all 13.2.3 No web app libraries found 13.2.4 Not possible to add source folder: source folder already exist or double entry in classpath or other message in Project Properties > Java Build Path > Source Folder 13.2.5 Build Path contains non-existing or double source folders (often module-related) 13.2.6 The project classpath is empty 13.3 Search Type: Shift-Ctrl T 13.4 Breadcrumb 13.5 Breakpoint expressions 13.6 Open type (f3) 13.7 Call Hierarchy, type hierarchy etc. 14 Known issues 15 Support http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Eclipse_IDE

Openbravo Eclipse Devel Setup

Embed Size (px)

DESCRIPTION

Eclipse setup for Openbravo

Citation preview

Page 1: Openbravo Eclipse Devel Setup

ERP/2.50/Developers Guide/Installation and setup of Eclipse IDE

Contents

1 Introduction2 Minimum requirements

2.1 Mercurial2.2 XML processors2.3 Eclipse IDE2.4 Mercurial Eclipse

3 Before getting started3.1 Eclipse workbench3.2 Eclipse workspace

4 Checking out Openbravo ERP source code4.1 Mercurial4.2 Subversion

5 Openbravo.properties file6 Importing Openbravo ERP projects

6.1 openbravo6.2 OpenbravoCore6.3 OpenbravoWAD6.4 OpenbravoTrl

7 Defining Tomcat server8 Compiling and building Openbravo ERP

8.1 Checks before the compilation and build8.2 Eclipse IDE compilation and build specifics8.3 eclipse.install.source8.4 OpenbravoCore8.5 Database8.6 OpenbravoWAD8.7 OpenbravoTrl8.8 openbravo8.9 Compilation and build issues

9 Running Openbravo ERP10 Debugging Openbravo ERP11 Eclipse Preferences

11.1 Formatting: Java Conventions11.2 Editor Save Actions11.3 Disable Validation11.4 Compiler settings

12 Developing Openbravo ERP13 Tips and Shortcuts

13.1 Build Problems13.2 Build Path Problems: Common Causes and Solutions

13.2.1 Build ant task failed, did not copy the jar files to the WEB-INF/lib directory13.2.2 Development project linked to wrong/non-existent Tomcat Server or not linked to a Tomcat server at all13.2.3 No web app libraries found13.2.4 Not possible to add source folder: source folder already exist or double entry in classpath or other message in Project Properties >Java Build Path > Source Folder13.2.5 Build Path contains non-existing or double source folders (often module-related)13.2.6 The project classpath is empty

13.3 Search Type: Shift-Ctrl T13.4 Breadcrumb13.5 Breakpoint expressions13.6 Open type (f3)13.7 Call Hierarchy, type hierarchy etc.

14 Known issues15 Support

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 2: Openbravo Eclipse Devel Setup

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'scommunity. For more general or technical information concerning Eclipse IDE, please visit:

Eclipse's introduction and documentation

Eclipse Newcomers Frequently Asked Questions (FAQ).Eclipse's documentation and help.

Eclipse's community

Eclipse's community.Eclipse Zone: community for Eclipse users and developers.Eclipse Plugin Central: Eclipse plug-in resource center.

Eclipse's resources and tutorials

Eclipse's Getting Started resources.Eclipse's resources.Getting started using Eclipse.Eclipse and Java video tutorials.An introduction to Eclipse for Visual Studio users.Eclipse IDE keyboard shortcuts.Eclipse shortcut keys.

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

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.

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

src-core, src-trl and src-wad are now folders that contain complete Eclipse subprojects, with a compilation output (build), source code (src)

folders and necessary libraries for each one.The build of source root for the ERP compilation.WebContent. A new folder named WebContent in the root source which contains all necessary files for the Apache Tomcat context (everything

but the compiled classes).*.launch files. These new files link Ant tasks to Eclipse IDE and allows them to be executed within the IDE.

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

PostgreSQL or Oracle databaseSun Java Development Kit (JDK)Apache TomcatApache Ant

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

Install and configure Mercurial in your operating system.

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.

If you miss these XML processors in Ant Home Entries, you will get "javax.xml.stream.FactoryConfigurationError: Providercom.bea.xml.stream.XMLOutputFactoryBase not found" error while doing export.database task.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 3: Openbravo Eclipse Devel Setup

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.

When clicking on OK button, a new workspace is created. Close the Welcome tab (get this tab back again by clicking Help > Welcome) and youwill see your workspace layout.

Important note: if you want to check out another Openbravo ERP source code to your machine in addition to the trunk (e.g., r2.40 tag

source code), just create a new workspace through File > Switch Workspace > Other.... Switch between your workspaces by selectingFile > Switch Workspace.

Install Mercurial Eclipse plug-in.

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 4: Openbravo Eclipse Devel Setup

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 Eclipseinstallation directory) with the following lines:

For a 1024 MB RAM machine:

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

For a 2048 MB RAM machine:

-showsplashorg.eclipse.platform-frameworkplugins/org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar-vmargs-Dosgi.requiredJavaVersion=1.5-Xms40m-Xmx1024m-XX:MaxPermSize=256m

This step is only required once since it affects your Eclipse IDE installation, hence, all your workspaces.More information about this issue:

Tuning Eclipse IDE performance and avoid OutOfMemoryExceptions problems.Faster Eclipse on slower machine.Linux, launchers and the PermGenSpace issue.

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, overwritingexisting 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.

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

Download the correct preferences file:For Openbravo 2.50: openbravo-eclipse-prefs.epf file.

Import workspace preferences by clicking on File > Import, selecting General > Preferences and clicking on Next button.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 5: Openbravo Eclipse Devel Setup

Browse to openbravo-eclipse-prefs.epf file, select Import all radio button and click on Finish button.

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, goto Eclipse IDE Window > Preferences... menu element and select Ant > Runtime > Ant Home Entries (Default). Click on Add External JARs... button

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 6: Openbravo Eclipse Devel Setup

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 validatorscheck boxes.

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 7: Openbravo Eclipse Devel Setup

Associate special file types to a XML editor. Click on General > Content Types then select Text > XML. Then click on Add... button (bottom right) andtype *.xsql in File type text box.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 8: Openbravo Eclipse Devel Setup

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.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 9: Openbravo Eclipse Devel Setup

More information on Eclipse IDE workspace configuration:

Eclipse's workbenches and workspaces.Effective Eclipse: setup your environment.Create New Eclipse Workspace - With All Your Old Settings.Effective Eclipse: Custom Templates.

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

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.

Important notes:

Please notice that Openbravo ERP trunk source code is not ready for production purposes.If you already installed Openbravo ERP using the installer and want to develop its code using Eclipse IDE, you can skip this step and godirectly to the import of Openbravo projects.

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.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 10: Openbravo Eclipse Devel Setup

Create a new repository location. In General tab, type https://dev.openbravo.com/svn/openbravo/ in URL text box and check Validate RepositoryLocation 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/.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 11: Openbravo Eclipse Devel Setup

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 12: Openbravo Eclipse Devel Setup

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.

Check Use default workspace location check box then click on Finish button.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 13: Openbravo Eclipse Devel Setup

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: During this stage, the Problems tab may display errors. They will disappear once Openbravo ERP is totally compiled and built.

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

If you checked out trunk source code, please read Openbravo.properties article in order to properly configure this file.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 14: Openbravo Eclipse Devel Setup

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 commandline, type:

ant -f build.xml.template setup

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

Once the assistant has finished, come back to Eclipse IDE, right click on openbravo project and select Refresh option.

Once the project has been refreshed, notice that, in config folder, Openbravo.properties file has been created with all the previously set up

information.

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 themmanually using Eclipse IDE.If you selected a context name different from openbravo (e.g., openbravotrunk), right click on openbravo project and select Propertiesoption. In Properties for openbravo pop-up window, select Web Project Settings, type your Context Root name then click on OK button.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 15: Openbravo Eclipse Devel Setup

The following projects are needed into your workspace before compiling: openbravo, OpenbravoCore, OpenbravoWAD and OpenbravoTrl. Pleasenote 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 needto 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 thesame steps as in OpenbravoCore to import openbravo project from openbravo folder.

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 16: Openbravo Eclipse Devel Setup

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.

OpenbravoTrl project contains the source code of the translator.

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

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.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 17: Openbravo Eclipse Devel Setup

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.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 18: Openbravo Eclipse Devel Setup

Once openbravo project is moved to Configured projects list, click on Finish button.

Tomcat v6.0 Server is now available in Servers tab.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 19: Openbravo Eclipse Devel Setup

Right click on it then select Open.

Overview file opens.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 20: Openbravo Eclipse Devel Setup

Under Server Locations, select Use custom location (does not modify Tomcat installation) radio button. Then type tomcat in Server path text boxand webapps in Deploy path text box.Under Ports, you can change port numbers if required.Under Server Options, select Serve modules without publishing check box if you want to see file modifications very quickly. By doing this,necessary files for Openbravo ERP to run are taken directly from WebContent folder inside Project Explorer tab. If you do not check this option,an openbravo context will be deployed (published) inside your_worskpace_name/tomcat/webapps folder. Anyway, this option can be checked orunchecked at any time and openbravo context will disappear and appear from your_worskpace_name/tomcat/webapps folder.Save Overview file.Outside Eclipse IDE, browse to your workspace path and notice that there are three folders: openbravo, Servers and tomcat.tomcat folder contains:

conf folder with necessary files to configure Tomcat.logs folder with a log file of the context.webapps folder with default ROOT context and openbravo context (if published).

If you get this error while running tomcat. java.lang.OutOfMemoryError: PermGen space. You have to alocate more memory for you tomcatinstance, to configure it, just click on "Open Launch Configuration" in the above window and you'll see the launch configuration window, openthe "Arguments" tab an add the line below to just in the end of the "VM arguments" filed. Remember to add the information just at the end of thefile, without any spaces.

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

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

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 setupprocess (the same setup process for Openbravo.properties file generation) in ERP 2.50 or later. org.eclipse.wst.common.component file make sure thedeploy 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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 21: Openbravo Eclipse Devel Setup

be copied from various places to WebContent to access the application in the development environment during the build purpose. The content oforg.eclipse.wst.common.component file will be minimal for generic purpose in .settings folder as default. We can copy the content fromorg.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:

In order to avoid problems with character sets, select openbravo, OpenbravoCore, OpenbravoTrl and OpenbravoWAD projects and click onProject > Properties. Then, in Properties pop-up window, click on Resource and select UTF-8 in Text file encoding panel in case Inherited fromcontainer (UTF-8) option is not selected.

Make sure that you have inside your Project Explorer tab:openbravo projectOpenbravoCore projectOpenbravoTrl projectOpenbravoWAD projectServers folder

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 22: Openbravo Eclipse Devel Setup

Check also that the following Ant tasks are inside Run > External Tools list:eclipse.install.sourcecreate.databaseeclipse.trl.libeclipse.wad.libeclipse.compile.complete

If any Ant task is missing from Run > External Tools list, select Run > External Tools > Organize Favorites... and Add them to the list.If you were not able to add the missing Ant tasks to Run > External Tools list, open Ant tab by selecting Window > Show View > Other... > Antthen drag build.xml file (inside general folder) to Ant tab. You will be able to execute Ant tasks by selecting them and click on Run the Selected

Target icon .

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 yourspecific environment. Restart Eclipse after setting JAVA_HOME.

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

First to be compiled, obtaining *.java files inside build/javasqlc folder.1.

Then built, obtaining *.class files inside build/classes folder.2.

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

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

In a single step by using eclipse.install.source Ant task.1.

Component by component in the following order:

OpenbravoCore project.1.

2.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 23: Openbravo Eclipse Devel Setup

The database.2.

OpenbravoWAD project.3.

OpenbravoTrl project.4.

openbravo project.5.

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

Select Run > External Tools > eclipse.install.source Ant task.In Console tab, see the progress of this process. Check that it ends with a BUILD SUCCESSFUL message.

Once built, check that, inside Project Explorer tab, error icons on the left side of OpenbravoWAD, OpenbravoTrl and openbravo projectshave disappeared.If you find any error, please take a look at Compilation and build issues section.

In Project Explorer tab, select OpenbravoCore project then select Project > Build Project menu item (see compilation errors in Problems tab).If you find any error, please take a look at Compilation and build issues section.

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

Go to Run > External Tools menu item then click on create.database Ant task. WARNING In order to include masterdata and sampledata

when creating the database (then not having problems doing Initial Client Setup) you have to force it using: ant create.database

-Dapply.on.create=trueSee the progress of this process in Console tab.If database parameters have been well configured inside Openbravo.properties file, create.database process should end with a BUILDSUCCESSFUL message.If you find any error, please take a look at Compilation and build issues section.

Select Run > External Tools > eclipse.wad.lib Ant task.In Console tab, see the progress of this process. Check that it ends with a BUILD SUCCESSFUL message.

Once built, check that, inside Project Explorer tab, error icon on the left side of OpenbravoWAD project has disappeared.If you find any error, please take a look at Compilation and build issues section.

Select Run > External Tools > eclipse.trl.lib Ant task.In Console tab, see the evolution of this process. Check that it ends with a BUILD SUCCESSFUL message.

Once built, check that, inside Project Explorer tab, error icon on the left side of OpenbravoTrl project has disappeared.If you find any error, please take a look at Compilation and build issues section.

Select Run > External Tools > eclipse.compile.complete Ant task.In Console tab, see the evolution of this process. Check that it ends with a BUILD SUCCESSFUL message.

Once built, check that, inside Project Explorer tab, error icon on the left side of openbravo project has disappeared.If you find any error, please take a look at Compilation and build issues section.

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., OpenbravoERP 2.35 MP5 or Openbravo ERP 2.40 beta), perform after each compilation tasks:

Inside Project Explorer tab, right click on the project that fails and Refresh it.Then select Project > Build Project menu item (see build errors in Problems tab).

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 24: Openbravo Eclipse Devel Setup

Issue 2

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

If errors persist, go to Project > Clean... menu item, select Clean all projects radio button, check Start a build immediately check-box then clickon OK button. By cleaning a project, all the content inside build folder (i.e., *.class files) is deleted.

If you still see a lot of errors inside Problems tab (more than 1.000), please check the dependency between openbravo and OpenbravoCore

projects. For this purpose, select openbravo project then right click and select Properties. Inside Java EE Module Dependencies section, make

sure that OpenbravoCore check-box is ticked (if it is not, select it) then click on OK button. Finally, go to Project > Clean... menu item, selectopenbravo project, check Start a build immediately check-box then click on OK button.

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 defineTomcat 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';

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 25: Openbravo Eclipse Devel Setup

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

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

Inside Eclipse IDE, start Tomcat server by clicking on Start the server icon in Servers tab.Once it starts, open your web browser and type your URL in the form http://hostname:port/context_name/ (e.g., http://localhost:8080/openbravo/).

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 Rootin 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 ofOpenbravo ERP. Please perform carefully these steps again before going on.

Type Openbravo in Username text box and openbravo in Password text box then click on Login button. Congratulations! You are done with

Openbravo ERP installation using Eclipse IDE :-)

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 26: Openbravo Eclipse Devel Setup

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) and selecting it in Role infomation pop-up window. You can also set this role as default by checking Set as default check box.

To stop Tomcat server, click on Stop the server icon in Servers tab inside Eclipse IDE.

Important note:

Please notice that you will not be able to debug if you installed JDK 1.6.0_14 [1]. This is the version installed from Ubuntu

repositories when typing sudo apt-get install sun-java6-jdk. Install manually JDK 1.6.0_16 (or above) instead [2].

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=279137 [2] http://ubuntuforums.org/showthread.php?t=1113039

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

Inside Eclipse IDE, start Tomcat server in debug mode by clicking on Start the server in debug mode icon in Servers tab.

Once it starts, open your web browser and type your URL in the form http://hostname:port/context_name/ (e.g., http://localhost:8080/openbravo/).Access Debug view automatically or by clicking on Debug perspective icon.

General Debug view (or perspective) opens and presents several tabs.The main tab is the one showing files to be debugged. Breakpoints can be added and deleted by double-clicking in the left side rose colored part

of the file.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 27: Openbravo Eclipse Devel Setup

Breakpoints tab shows all breakpoints defined all over the code. This tab also allows to delete or skip desired ones.

Navigate Openbravo ERP as usual via your web browser. Once the application reaches an active breakpoint, execution stops and the control

is handed over to you.

Move to the next code line by clicking on Step Over icon or by pressing F6 key.

Jump inside a method by clicking on Step Into icon or by pressing F5 key.

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

Return from a method by clicking on Step Return icon or by pressing F7 key.

Jump to the next breakpoint or finish debugging by clicking on Resume icon or by pressing F8 key.

Stop debug server by clicking on Terminate icon or by pressing Ctrl+F2 keys.

Track the values of variables inside the Variables tab.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 28: Openbravo Eclipse Devel Setup

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

Eclipse and Java: using the debugger.Tips and tricks for debugging in Eclipse.How to debug a remote Java application.

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

To set the Eclipse preferences go to Window > Preferences

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

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 29: Openbravo Eclipse Devel Setup

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

Eclipse automatically validates xml, jsp and html files. Although this can be a usefull feature it is very resource intensive. The Openbravo developmentproject has many xml and html files which makes it impossible to use this feature in automatic build mode. Disabling this feature makes it possible towork 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.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 30: Openbravo Eclipse Devel Setup

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

Code StyleUndocumented empty blockParameter Assignment

Potential programming problemsPossible accidental boolean assignmentEmpty StatementEnum type constant not covered in switchSwitch case fall-throughPotential null pointer access

Name shadowing and conflictsField declaration hides another field or variableLocal variable declaration hides another field (but keep include Constructor and setter method parameters unchecked)

Deprecated and restricted APIDeprecated API: check the Signal overriding or implementing deprecated method

Development using Eclipse IDE follows the same principles as command line development of Openbravo ERP. Please find more information aboutOpenbravo ERP development at Openbravo ERP developer's guide.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 31: Openbravo Eclipse Devel Setup

Eclipse will display compile and other problems in the Problems view. There is one problem which is important to keep in mind when working witheclipse, 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 theclasses. 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 noticethat the debugger is not insync with your source code. So if you encounter the situation that your source changes are not reflected when running eclipsethen check the project properties and specifically the build path section.

The build path problem is one of the more annoying issues when developing with Eclipse as it is sometimes unclear why they happen. This sectiongives an overview of the main things to check when you are having build path problems. It provides also some solution (directions). In any case itmakes sense to do refresh/clean project a number of times when you are encountering build issues. Also rebuild the project either manually or bychecking the build automatically check flag in the Project drop down menu.

Build ant task failed, did not copy the jar files to the WEB-INF/lib directory

As the build ant tasks print a lot of information it is possible that failures are not directly noticed. The build ant tasks also copy the jar files from thelib/runtime directory to the WEB-INF/lib directory. If the build task failed then this step has not been done and the WEB-INF/lib directory is empty. InEclipse the WEB-INF/lib directory is located within WebContent.

To solve this situation check why your the ant task failed (check the output) and re-do the build steps.

Development project linked to wrong/non-existent Tomcat Server or not linked to a Tomcat server at all

The Eclipse project builder uses the jar files provided by the Tomcat installation during its build. If the project is not linked to a correct server then itwon't find these jar files and report build errors. You can check if the Tomcat jar files are find by going to the project properties > Java Build Path >Libraries section. There should be an Apache Tomcat section there. If none is found there you can add the project to a server through the servers view(Window > Show View > Other, select Server view). Or in the Java Build Path window by clicking 'Add Library' and selecting a Server Runtime.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 32: Openbravo Eclipse Devel Setup

No web app libraries found

In this case the WebContent/WEB-INF/lib directory contains all the required jar files but Eclipse does not place them on the project build path. Toanalyze this situation goto the Project Properties > Java Build Path and the Libraries tab. There should be an entry for 'Web App Libraries' there whichcontains many jar files (see the image below).

If there is no Web App Libraries then click 'Add Library' and then select Web App Libraries and in the next step the relevant Openbravo web project.

if there is a Web App Libraries section but it is empty then remove this entry and add it again.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 33: Openbravo Eclipse Devel Setup

If the above steps did not help then you need to go into checking the Eclipse configuration files: Open a console and go to the Openbravo developmentproject. Check that there is a file called: '.classpath' (note it starts with a dot!). If not then check the next section. Check the contents of your .classpathfile. It should be something similar to this:

<?xml version="1.0" encoding="UTF-8"?><classpath>

<classpathentry exported="true" kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/><classpathentry including="**/*.ext|**/*.hbm.xml|**/*.java|**/*.oaw|**/*.properties|**/*.xml|**/*.xpt|**/*.xslt" kind="src" path="src"/><classpathentry kind="src" path="build/javasqlc/srcAD"/><classpathentry kind="src" path="src-diagnostics/src"/><classpathentry kind="src" path="build/javasqlc/src"/><classpathentry kind="src" path="src-test"/><classpathentry excluding="eclipse/" including="quartz.properties" kind="src" path="config"/><classpathentry kind="src" path="src-gen"/><classpathentry including="**/*.java" kind="src" path="srcAD"/><classpathentry kind="lib" path="lib/runtime/org.openarchitectureware.core.workflow_4.3.1.20080910-1400PRD.jar"/><classpathentry kind="lib" path="lib/build/junit.jar"/><classpathentry kind="lib" path="lib/build/js.jar"/><classpathentry exported="true" kind="con"

path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/><classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/><classpathentry kind="lib" path="src-wad/lib/openbravo-wad.jar" sourcepath="src-wad/src"/><classpathentry kind="output" path="build/classes"/>

</classpath>

The tomcat runtime name may be different in your case but there should be a kind="con" entry present in the file.

If it looks fine then next go into the .settings directory and check that you have a file called: org.eclipse.wst.common.component. If not you can copy itfrom the file: org.eclipse.wst.common.component.template located in that same directory. The content of the org.eclipse.wst.common.component fileshould be something like this:

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 34: Openbravo Eclipse Devel Setup

<?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>

Not possible to add source folder: source folder already exist or double entry in classpath or other message in Project Properties > JavaBuild Path > Source Folder

This error message is displayed when you manually try to add a source folder to the Project Properties > Java Build Path > Source Folder tab. This canhappen because there is already an entry for the source folder you are trying to add in one of the two following files:

.classpath

.settings/org.eclipse.wst.common.component

Eclipse won't display this entry in the source folder view so it is not directly apparent why adding a new entry is not possible.

To solve this remove the entry from the .classpath or the .settings/org.eclipse.wst.common.component file:

in these files: check the xml elements kind="src" or with a source-path attribute.1.

remove the xml elements/tags which refer to the source folder you want to add2.

refresh the project in Eclipse.3.

Build Path contains non-existing or double source folders (often module-related)

It is possible through a combination of different actions to end up with source folders which do not exist anymore or even double source folders (thesame source folders present more than once). Some possible causes:

removing modules (with a src-folder) manually from the modules directory and then doing install.sourceremoving source folder manually

You can analyze this situation by going into the Project Properties > Java Build Path > Source Folders. If there is something wrong you will see anerror message displayed. Removing the incorrect source folders should remove this situation.

The project classpath is empty

You have many compile errors and the Java Build Path only shows an entry for the JDK. One way or another you lossed the .classpath file in theOpenbravo project directory. To solve this copy the file .classpath.template (located in the Openbravo project directory) to .classpath and re-startEclipse/re-open the workspace. Then check the other topics in this section to see if you need to manually add classpath information in the ProjectProperties > Build Path.

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 thisfeature is available in the java and java EE perspectives.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 35: Openbravo Eclipse Devel Setup

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 handywhen you open a file as part of a search action (so not by browsing the explorer tree).

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 36: Openbravo Eclipse Devel Setup

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.

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

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

Openbravo's Frequently Asked Questions (FAQ).Eclipse's IDE known issues.

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE

Page 37: Openbravo Eclipse Devel Setup

Subversion checksum mismatch.

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

http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/Installation_and_setup_of_Ec lipse_IDE