Setting up Eclipse
Materialize and Build
On the operating system, navigate to the folder where you cloned the code, named below as $IDEMPIERE_REPOSITORY (e.g., /home/carlos/sources/idempiere), and run:
cd $HOME/sources/idempiere
./mvnw verify
You need around 5GB of free disk space to run this step.
This command downloads all libraries on Bundle-ClassPath, builds all projects, and outputs binaries to org.idempiere.p2/target/products.
Setup Workspace in Eclipse
- Open Eclipse with the workspace pointing to the folder where you cloned the code.
- Example:
$HOME/sources/idempiere(just a recommendation, you can use any folder as your workspace)
- Example:
- Turn off Project > Build automatically
- Navigate to Window > Preferences > General > Workspace
- Set Text file encoding to UTF-8 (if default is different)
- Set New text file line delimiter to Unix (if default is different)
- (Optional) Switch to Java perspective and choose Working Sets as the Top Level Elements
- Heng Sin prefers the Plug-in Development perspective for easy access to plugin and target platform state.
- In Java > Installed JREs, add the
java-17-openjdkJRE if not present and select it as the active JRE:- Click Add
- Select Standard VM, click Next
- Enter
/usr/lib/jvm/java-17-openjdk-amd64as JRE Home (or use Directory... to find the JRE/JDK 17 root folder), click Finish - Click the Checkbox next to the new entry to apply changes
- Navigate to Window > Preferences > Java > Compiler
- Set Compiler compliance level to 17
Import Projects in Eclipse
- Navigate to File > Import
- Select Maven > Existing Maven Projects
- Click Next and Browse... to select the cloned idempiere source folder
- Example:
$HOME/sources/idempiere
- Example:
- All projects must appear selected, click Finish to complete the import
- At the end, all projects are loaded into the workspace
- Sometimes Eclipse creates changes to the workspace; you can discard those changes via right-click on the projects and select Replace With > HEAD Revision
Set Target Platform
Using Downloaded Libraries
- Open the
org.idempiere.p2.targetplatform.mirror.targetfile inside theorg.idempiere.p2.targetplatformproject - In Target Editor, click Set as Active Target Platform
- Enable back Project > Build automatically
- If there are files with compilation errors, right-click on the iDempiere project and select Maven > Update Projects, then press OK
- When everything is good, close the target editor with
org.idempiere.p2.targetplatform.mirror.target. Keeping it open may cause erratic behavior in Eclipse (especially after restart).
Downloading Sources Libraries
If you want to have the source code for the target platform downloaded libraries, there is an alternative method.
This method is slower (depends on your internet speed), and consumes more disk space (around 287MB more at this moment).
The advantage is that you'll have the source code for the target platform contents and everything is set up if you need to debug into the target platform plugin (which is rare anyway).
- Open the
org.idempiere.p2.targetplatform.targetfile inside theorg.idempiere.p2.targetplatformproject- This is the default target platform definition with remote URL
- Eclipse takes some time downloading the required dependencies (how long depends on your internet connection)
- In Target Editor, click Set as Active Target Platform
- Wait for Eclipse to finish downloading bundles onto target platform
- Click the Reload button if some downloads fail, until there are no red errors on the Locations list
- Enable back Project > Build automatically
- If there are files with compilation errors, right-click on the iDempiere project and select Maven > Update Projects, then press OK
- When everything is good, close the target editor with
org.idempiere.p2.targetplatform.target. Keeping it open may cause erratic behavior in Eclipse (especially after restart).
Eclipse Version
The minimum version to run iDempiere is Eclipse 2024-03, specifically the Eclipse IDE for Enterprise Java and Web Developers.
If you use Eclipse IDE for Java Developers instead, you'll find some problems when compiling. To overcome that, install the m2e PDE - Maven Integration for Eclipse Plugin Development plugin (check at Help > About Eclipse IDE > Installation Details > Installed Software tab). Install it from https://download.eclipse.org/releases/latest (Help > Install New Software...). This plugin sits inside the General Purpose Tools category.
Notes about Target Platform
- If you want to make changes to the target platform, you might want to install the Target Platform DSL Editor from https://download.eclipse.org/cbi/tpd/3.0.0-SNAPSHOT/ (Help > Install New Software... and enter the URL into the "Work with:" field). This plugin allows you to generate new
org.idempiere.p2.targetplatform.targetfile fromorg.idempiere.p2.targetplatform.tpd. Note that after you have generated a neworg.idempiere.p2.targetplatform.targetfile, you need to manually copy the maven locations frommaven.locations.xmlinto it. - If you want to use a local/mirror target platform with the source, you can use my file or create one yourself by following this guide.
This How-To is brought to you by Carlos Ruiz from BX Service GmbH. Feel free to improve directly or suggest using the Discussion tab.