Setting up Eclipse
⇐ Table of Contents | Download the Code | Setting up Eclipse | Importing DB Seed Manually ⇒
Materialize and build
On the operating system navigate to the folder where you cloned the code, named below as $IDEMPIERE_REPOSITORY (f.e. /home/carlos/sources/idempiere), and run the next command:
cd $HOME/sources/idempiere mvn verify
This command download all libraries on Bundle-ClassPath, build all projects and output binaries to org.idempiere.p2/target/products. If not, verify with mvn -version that maven is using the correct java-version.
Setup workspace in Eclipse
- Open again the eclipse you configured with the workspace pointing to the folder where you cloned the code
- Following the example here this folder would be $HOME/sources/idempiere - this is just an example recommendation, not a must, you can use any folder as your workspace
- 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 the default is different)
- Not required, this is a personal preference, but normally I switch here to Java perspective and choose Working Sets as the Top Level Elements
- in Java > Installed JREs add the java-17-openjdk JRE if not present and select it as the active JRE:
- click the Add button, then
- select Standard VM, click next
- enter "/usr/lib/jvm/java-17-openjdk-amd64" as JRE Home, click finish
- click the Checkbox next to the new entry to apply the changes.
- Navigate to Window > Preferences > Java > Compiler
- set Java > Compiler > Compiler compliance level to "17"
Import projects in Eclipse
- Navigate to File > Import
- Navigate to Maven > Existing Maven Projects
- Click Next button and Browse to $IDEMPIERE_REPOSITORY (must appear there by default)
- Following the example here this folder would be $HOME/sources/idempiere
- 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 at this point via right click on the projects and choosing Replace With > HEAD Revision
Set target platform
- Now open the file org.idempiere.p2.targetplatform.target within the project org.idempiere.p2.targetplatform
- This is the default target platform definition with remote url
- Here eclipse takes some time downloading the required dependencies, you can prepare some Colombian coffee and wait patiently :)
- At Target Editor, click the "Set as Active Target Platform" link
- Wait for Eclipse to finish downloading bundles onto target platform
- Click the "Reload" button if some download fail, until there are no red errors on the Locations list
- At the end you can enable back Project > Build automatically
- In case there are files with compilation errors you can right click on the iDempiere project and select Maven > Update Projects, then press OK
- When everything is good, close the target editor for org.idempiere.p2.targetplatform.target. Keeping it open makes Eclipse produce erratic behavior (especially after you restart your Eclipse).
Eclipse version
As explained in the prerequisites the minimum version to run iDempiere is Eclipse 2024-03, and specifically the version "Eclipse IDE for Enterprise Java and Web Developers".
In case you decided to go against the recommendation and use instead "Eclipse IDE for Java Developers" you'll find some problems when compiling, to overcome that you must install the "m2e PDE - Maven Integration for Eclipse Plugin Development" plugin (check at Help > About Eclipse IDE > Installation Details > Installed Software tab), you have to 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.target file from org.idempiere.p2.targetplatform.tpd. Note that after you have generated a new org.idempiere.p2.targetplatform.target file, you need to manually copy the maven locations from maven.locations.xml into it.
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.
⇐ Table of Contents | Download the Code | Setting up Eclipse | Importing DB Seed Manually ⇒