기타(framework)
2018.10.03 / 23:08

자바 오픈 erp 소스 공개 소스 - How to setup Eclipse IDE

Chitta
추천 수 18

/openbravo




Clone or download 

 README.textile

Openbravo ERP

This is the Bippo development version of Openbravo ERP.

More info: ERP Development Setup | Bippo Development Guide

Useful references:

Preparation

Tomcat Setup

Install Tomcat 6.0.x binary distribution (don’t use its Ubuntu package). 
Do NOT use Apache 7.0!
(Hendy’s note: maybe should try to use JBoss AS)

a. Extract Tomcat distribution as $HOME/openbravo-tomcat (do not use the apache-tomcat-x.x.x folder)
This folder will be referred to as $CATALINA_HOME.
b. Set CATALINA_HOME environment variable in ~/.bashrc because it will be used by Openbravo Setup Ant script
c. Set CATALINA_OPTS environment variable in ~/.bashrc as follows: (to fix PermGen error)

export CATALINA_OPTS="-Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M"

d. Copy the tools.jar file (from JDK in /usr/lib/jvm/java-1.6.0-openjdk/lib) to Tomcat’s lib/ folder. 
e. In order to avoid Tomcat from auto-reloading itself, comment the <WatchedResource> line in $CATALINA_HOME/conf/context.xml
f. Create administrator user
g. Start Tomcat

PostgreSQL Setup

Install PostgreSQL 8.4 with UUID support : install Ubuntu packages postgresql-8.4postgresql-contrib-8.4
Do NOT use PostgreSQL 9.1 with Openbravo (yet)!

a. Check if 8.4 main cluster exists. If not, create 8.4 main cluster at port 5433.
b. Start PostgreSQL 8.4
c. Set password for postgres user in the 8.4 main cluster

Installation

1. Make sure Apache Tomcat 6.0 is running
2. Make sure PostgreSQL cluster 8.4 main is running

3. Download the setup binary (setup-properties-linux-x64.bin) corresponding to your system
and put it on config/ folder.
It is available at Bippo intranet Nexus, search for setup-properties-linux-x64.

Internal note: If you want to download setup-properties directly from Openbravo upstream, run:

ant setup

4. Run the downloaded file in the config directory. For example in
amd64 Linux:

config/setup-properties-linux-x64.bin

Internal note: If there is no setup binary for your operating system and architecture,
send a request to <staff.rm at openbravo dot com>.

5. To install it run:

ant install.source

It creates the database structure, builds the core, compiles
Openbravo and generates a war file.

Deploy this war file into the tomcat/webapps directory.

Eclipse Projects Setup

1. Copy classpath.sample to .classpath
2. Do a Git Import from each of these folders in ~/git/openbravo :

a. /
b. src-core/
c. src-trl/
d. src-wad/

You should get 4 Eclipse projects named:

a. openbravo
b. OpenbravoCore
c. OpenbravoTrl
d. OpenbravoWAD

Reference: How to setup Eclipse IDE

Documentation

See Openbravo Wiki for more documentation.

Helping out

If you’d like to help out, great!

Have a look to our Contributor’s Guide

There is also a list of on-going community projects

Please share your changes so others can benefit.

Please use svn diff to prepare patches.

Contact

IRC: #openbravo in freenode



How to setup Eclipse IDE

Contents

 [hide]

Preparing development environment

First of all you need to install and configure different components of the Openbravo ERP environment as it's described in Custom Installation guide. In order to comply to development requirements some of those components have to be additionally adjusted according to Development Stack Setup.

Bulbgraph.png  Double check that you have read and followed the Development Stack Setup article

After completing all of the steps in the aforementioned guides, please make sure that:

  • Your OS user has read/write access to your tomcat installation home directory (CATALINA_BASE).
  • Environment variables (e.g. ANT_OPTS, CATALINA_OPTS, JAVA_HOME, ANT_OPTS, etc) are declared in the proper categories (i.e. System/User variables) (windows only)
  • You have downloaded the latest Eclipse IDE for Java EE Developers release .

Download source code

The source code can be checked out using any Mercurial client. There is no any restrictions on the read access so you wouldn't need any credentials to access the repository. The detailed procedure of the source code check out is described in Mercurial Manual for Openbravo Developers. As it's explained in the guide it's normally considered as a good practice to have a pristine clone and working one, so we would strongly encourage you to follow that 'rule'. It is also highly advisable to clone the repository into a destination directory which is outside of Eclipse workspace.

If you want to build the latest stable release:

$ hg clone https://code.openbravo.com/erp/devel/main openbravo
$ cd openbravo
$ hg up 3.0PR18Q3.1

For Openbravo developers, you should work with the pi repository:

hg clone https://code.openbravo.com/erp/devel/pi
$ cd pi

Openbravo installation

The Openbravo ERP installation is performed in several steps.

Configure the properties

So, first of all you have to configure the Openbravo ERP by specifying some general properties, e.g. Tomcat installation directory, database connection details, etc. This can (and in fact must) be done via a console application which has to be compile first. For that, go to the directory with the working clone of the repository and execute:

ant setup

The invocation of this ant target will compile and execute automatically a console application.By going through the console application provide all requested information and at the end, select Accept to apply the changes and close the application.

Note: More about setup ant task can be found at Openbravo.properties#Edition.

As a result of these actions a new file Openbravo.properties, containing specified settings, will be created in config subdirectory.

Bulbgraph.png  While going through the console application, DO NOT change the default context name which is openbravo. This guide assumes that it will be left this way.

More about the properties can be found at Openbravo.properties. Now the Openbravo ERP is ready to be installed.

Install from sources

In order to install the Openbravo ERP three main procedures have to be accomplished:

  • the Openbravo ERP database has to be created and populated with some initial values
  • sources have to be generated
  • all sources have to compiled to binaries which later can be executed on a WEB server (Tomcat).

All this is done by invoking from the root of the working clone (XXX\opensource\openbravo\erp\devel\main\).

ant install.source

This process can take quite long time (up to 25 min) depending on hardware configuration. It's always a good idea to redirect the output of the task execution to a log file which then can be analyzed or sent to the support team in case of problems. After the task has completed the log should not contain any error or exception massages as well as it should have BUILD SUCCESSFUL message at the end of the file. (if you are under Linux use grep command to check whether the file contains any exceptions). After successful installation the next step can be taken - importing to Eclipse IDE.

Bulbgraph.png  You can save the install.source log using tee in Linux or mtee in Windows

Problems running install.source

If you find problems running install.source, check the Installation/Troubleshooting article

Import into Eclipse IDE

Launch Eclipse.

Bulbgraph.png  After Eclipse has started go to Project menu and disable Build Automatically option there.

Now 4 projects need to be imported in the workspace (by menu File=>Import and then General=>Existing Projects into Workspace). Here they are:

openbravo        XXX\opensource\openbravo\erp\devel\main\
OpenbravoCore    XXX\opensource\openbravo\erp\devel\main\src-core
OpenbravoTrl     XXX\opensource\openbravo\erp\devel\main\src-trl
OpenbravoWAD     XXX\opensource\openbravo\erp\devel\main\src-wad

Create the Tomcat Server

Then open Servers view and create a new instance of Tomcat server:

Tomcat.server.JPG

While going through the wizard select openbravo and add it to configured resources. Then click "Finish". The created instance should appear in the view. Double click on it to change its settings in the form depicted on the picture below:

Tomcat.server.2.JPG
  • Check the flag "Serve modules without publishing".
  • In the modules tab edit openbravo module and uncheck the "Auto reloading enabled" flag.

Change VM arguments settings

  • in General Information
    • click on Open launch configuration link
    • switch to Arguments tab
    • add the following line at the end of VM arguments input:
 -server -Djava.awt.headless=true -Xms384M -Xmx1536M -XX:MaxPermSize=256M 
  • in Server options
    • check the Serve modules without publishing
  • in Timeouts
    • set Start and Stop timeouts to 120 seconds

After changing all, save your server configuration (press Ctrl+S).

Renaming server

When creating a new server, by default is is named "Tomcat v7.0 Server at localhost". This name can be changed to something custom, both at creation time or later by editing it in server window.

In this case, it is necessary to bind the Server Library with the actual server. To do so:

  • In Project Explorer view, right click on openbravo project and select Properties.
  • Select Java Build Path left menu item.
  • Select Libraries tab, there you should see Server library is marked as unbound.
  • Click Edit button.
  • Select your server.
Eclipse bind tomcat.png

Import Preferences

The next step is to set the standard preferences used in the development of Openbravo.

  • The preference file is located in the openbravo/config/eclipse folder in the development project
  • Import workspace preferences clicking on File > Import, then select General > Preferences and click on Next button.
ImportPreferences1.jpg
  • Browse to openbravo/config/eclipse/openbravo-eclipse-prefs.epf file, select Import all radio button and click on Finish button.
ImportPreferences2.jpg

Once finished, select all the projects, refresh them, and rebuild them (right click on one or more projects and you will find the Refresh and the Rebuild options). You should get warnings, but not errors.

Bulbgraph.png  Latest Eclipse releases starting from Mars do different Java formatting than previous ones. In order to maintain the same formatting, it is necessary to install old formatter as plugin. Read here more details on how to do it.

Launch from Eclipse

Now start the Tomcat server by right-clicking on the server instance in the Servers view and choosing Start option in the popup menu. Wait until the server is started (can take up to 2 minutes) and visit http://localhost:8080/openbravo/ in your internet browser. If everything was configured and installed properly you will get to the Openbravo ERP log in page. Use these credentials to log in:

  • username - Openbravo
  • password - openbravo

both are case sensitive.

That's it, the installation is over and you're ready to start developing.

Bulbgraph.png  If your system has enough resources (memory/processor) then you can try enabling the Build Automatically option in the Project menu. Enabling it will give you direct feedback while developing.

Upgrading old workspaces to >=PR17Q1

Starting from PR17Q1, the minimum System Requirements for Openbravo were increased to Java 7 and Tomcat 7. For worskpaces created in older versions, some upgrade might be required.

  • JDK >=7 and Tomcat >= 7 need to be installed in the system
  • Eclipse must be at least in Indigo release, though latest version is recommended

Once updated to a newer version on a recent stack, it will be automatically allowed to write Java 7 compliant code.

If Tomcat 6 was used, the server needs to be removed and a new Tomcat >=7 needs to be created, after it, a rebuild will be required, see how here.


Warn-icon.png  If you are developing modules compatible with older Openbravo versions or creating code to be backported to those, the code needs to be still compatible with Java 6. In these cases it is recommended to use workspace with older (previous to 3.0PR17Q1) Openbravo sources.

Upgrading old workspaces to >=PR18Q4

Starting from PR18Q4, the minimum JDK required for Openbravo was increased to Java 8. For worskpaces created in older versions, some upgrade might be required.

  • JDK >=8 need to be installed in the system
  • Eclipse must be at least in Luna release, though latest version is recommended

Once updated to a newer version on a recent stack, it will be automatically allowed to write Java 8 compliant code.

Warn-icon.png  If you are developing modules compatible with older Openbravo versions or creating code to be backported to those, the code needs to be still compatible with Java 7. In these cases it is recommended to use workspace with older (previous to 3.0PR18Q4) Openbravo sources.