Develop in IDEA - bobbyiliev/dbeaver GitHub Wiki

Develop and debug DBeaver in IntelliJ IDEA

Well, this is a tricky part.

Intro

Why

DBeaver is based on Eclipse Platform and it seems logical to develop it in Eclipse IDE. However, many people find that even the latest Eclipse Java IDE is not as good and convenient as IntelliJ IDEA.
I personally also prefer to develop in IDEA - mostly because of past experience but also because of many really helpful features in it.
Anyhow, here we will try to open the DBeaver project in IDEA, write code, compile code, run and eventually debug (as Java debugger really rocks in IDEA).

How

It is quite easy to open the project, see the module structure and even compile it.
But running/debugging is the trickiest part because it requires Eclipse runtime workspace and only Eclipse IDE can create one (IDEA does not support this and nobody can blame JetBrains for that).
So, we will still need Eclipse to configure the workspace for the debugger. But once you do this, you will no longer need to run Eclipse (until the plugin structure or versions change).

Let's start!

Instructions

Opening DBeaver in IDEA

  1. Create some folder where you will clone DBeaver repositories. Note: all repositories must be located in the same folder. For example dbeaver-ce.
  2. cd dbeaver-ce
  3. git clone https://github.com/dbeaver/dbeaver.git
  4. git clone https://github.com/dbeaver/dbeaver-idea-project.git
  5. Optional: git clone https://github.com/dbeaver/dbeaver.wiki.git (skip it if you do not need WIKI)
  6. Start IDEA->Open. select folder dbeaver-ce/dbeaver-idea-project
  7. Now you can see the DBeaver modules structure:
  8. You can edit the code but you cannot compile it because there are no Eclipse dependencies configured.

Prepare Eclipse IDE and workspace

  1. Perform all steps described in the Develop in Eclipse article. Use just cloned dbeaver-ce/dbeaver as the source root.
  2. Eventually, you should be able to compile and run DBeaver from Eclipse
  3. Remember where your Eclipse IDE is located (let's say eclipse-ide-path)

Configuring dependencies and compiling the application

  1. Now we need to add Eclipse dependencies in the IDEA project configuration.
  2. Open File->Project structure....
  3. Make sure you have the proper project Java SDK configured (Java 11+)
  4. Go to Global libraries.
  5. Click the "Add" button. Select Java. Select the folder eclipse-ide-path/plugins. Click the OK button, then the dialog to add the library to modules will appear. In the dialog, press "Cancel"
  6. Change the library name to ECLIPSE (name and case are important)
  7. Recent IDEA should add all Eclipse jars as dependencies. But in some IDEA versions you will also need to add some other folders manually:
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.batik*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.poi*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.poi*/ooxml-lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jfreechart*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.sshj*/lib.
  8. If that is not enough, add all folders in eclipse-ide-path/plugins/org.jkiss*. Then manually download and add Mockito and JUnit.
  9. Eventually you will see something like this:
  10. Now, you should be able to compile the project. Just hit CTRL+F9 and wait.

Running and debugging

DBeaver is an Eclipse RCP and must be started using the Eclipse Equinox Launcher bundle. This is a special jar file that resides in the Eclipse plugins folder and we need to add it to dependencies directly in order to be able to debug.

  1. Add the launcher config as a jar dependency for module dbeaver. Locate the jar org.eclipse.equinox.launcher_*.jar in the eclipse-ide-path/plugins/ folder. Like this:
  2. Open debug configuration "Debug DBeaver Community" and change the path in the parameters -configuration and -dev.
    Replace the path before .metadata with a path to your Eclipse workspace. Eventually, it should look like this:
  3. Click ok and run the debugger. DBeaver must start. Now you can enjoy debugging in IDEA :)

Additional information

Can't launch DBeaver debug on macOS/Linux

Initial launch arguments are used for Windows launch. You need to change them manually. Open debug configuration "Debug DBeaver Community" and find these parameters. -os win32 -ws win32 -arch x86_64 You may need to replace them. Fortunately, Eclipse debug configuration uses correct arguments automatically. Open Eclipse debug configuration which you created while completing Develop in Eclipse, press Show Command Line. Pressing this button will open a dialog window. The dialog will contain required arguments, copy them and paste them to the IDEA debug configuration.

Problems

Most likely, something will go wrong as these instructions are quite long. Do not be afraid to recheck the configuration and try again. If nothing helps - do not hesitate to ask at tickets.

⚠️ **GitHub.com Fallback** ⚠️