DBeaver Documentation

DOWNLOAD pdf

Develop in IDEA

Overview

DBeaver is built on the Eclipse Platform, making the Eclipse IDE a logical choice for its development. However, many developers prefer the IntelliJ IDEA.

In this guide, we aim to demonstrate how to open the DBeaver project in IDEA, write and compile code, and, most importantly, run and debug the application, leveraging the excellent Java debugger available in IDEA.

Instructions

Opening the project and understanding its module structure in IDEA is relatively straightforward. The complexity arises when attempting to run or debug the project, as this process requires an Eclipse runtime workspace, a feature exclusive to the Eclipse IDE that IntelliJ IDEA does not support. Therefore, Eclipse is still necessary to configure the workspace for debugging purposes. Once configured, however, Eclipse will not be needed unless there are changes to the plugin.

Opening DBeaver in IDEA

  1. Create a folder where you will clone DBeaver repositories.

    Note: all repositories must be located in the same folder. For example, name it dbeaver-ce.

  2. Navigate to the created folder using the command: cd dbeaver-ce.
  3. Clone the DBeaver repository with: git clone https://github.com/dbeaver/dbeaver.git.
  4. Clone the IDEA project settings with: git clone https://github.com/dbeaver/dbeaver-idea-project.git.
  5. Clone the common components with: git clone https://github.com/dbeaver/dbeaver-common.git.

    Tip: Optionally, for documentation purposes, clone the WIKI repository with: git clone https://github.com/dbeaver/dbeaver.wiki.git (skip this step if you do not need the WIKI).

  6. Launch IDEA, choose Open, and select the folder dbeaver-ce/dbeaver-idea-project.
  7. Now, you should see the DBeaver modules structure:

Note: You can edit the code, but you cannot compile it yet due to missing Eclipse dependencies.

Prepare Eclipse IDE and workspace

  1. Follow all the steps outlined in the Develop in Eclipse article, using the just cloned dbeaver-ce/dbeaver as the source root.
  2. After completing these steps, you should be able to compile and run DBeaver from within Eclipse.
  3. Make a note of your Eclipse IDE's location, referred to as eclipse-ide-path.

Configuring dependencies and compiling

  1. First, we need to add Eclipse dependencies to the IDEA project configuration.
  2. Navigate to File -> Project Structure....
  3. Ensure the project's Java SDK is correctly configured (Java 17 or newer is required).
  4. Proceed to the Libraries section.
  5. Click the Add button, choose Java, then select the eclipse-ide-path/plugins folder. After clicking the OK button, a dialog will appear to add the library to modules. In this dialog, click Cancel.
  6. Rename the library to ECLIPSE (both the name and case are significant).
  7. Recent versions of IDEA should automatically include all Eclipse JARs as dependencies. However, you may need to add some libraries manually.

    • eclipse-ide-path/plugins/com.sun.jna*.
    • eclipse-ide-path/plugins/org.jkiss.bundle.antlr*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.batik*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.dbcp*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.apache.poi*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.gis*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.gpt3*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.graphql.java*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jackson*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jetty.server*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jetty.websocket*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jfreechart_*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.jsvg_*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.logback_*/lib.
    • eclipse-ide-path/plugins/org.jkiss.bundle.sshj_*/lib.
  8. You should see the following list:

  9. If there are any other missing dependencies, add all folders in eclipse-ide-path/plugins/org.jkiss*.

Tip: If you require tests, manually download and add Mockito and JUnit.

  1. Before compiling, you will need to build parser grammar files. To do this, locate org.jkiss.dbeaver.model.lsm in your Project. Right-click on the module and select Open In -> Terminal. Then, execute mvn clean install in the terminal.

  2. If the module does not compile, first build the dbeaver-common components, and then, in the dbeaver folder, run the build process again.

Tip: If your processor has more than one core, execute the command mvn clean install -T 1C to speed up compilation. This will not be effective if there is insufficient RAM.

  1. To avoid version conflict when compiling JSCH module open in project explorer External Libraries -> ECLIPSE and locate two libraries called com.jcraft.jsch_*.jar remove the older version before proceeding.
  2. Now, you should be able to compile the project. Hit CTRL+F9 and wait.

Running and debugging

DBeaver is an Eclipse RCP application and must be started using the Eclipse Equinox Launcher bundle. This involves a special JAR file found in the Eclipse plugins folder, which we need to add directly to dependencies to enable debugging.

  1. Add the launcher configuration as a JAR dependency for the dbeaver module. Locate the JAR org.eclipse.equinox.launcher_*.jar in the eclipse-ide-path/plugins/ folder, as shown here:

  2. Open the debug configuration "Debug DBeaver Community" and modify the path in the parameters -configuration and -dev.
    Replace the path preceding .metadata with the path to your Eclipse workspace. It should eventually look like this:

  3. Click OK and start the debugger. DBeaver should launch, allowing you to debug using IDEA.

Additional information

Cannot launch DBeaver debug on macOS or Linux

The initial launch arguments are set for Windows. You will need to adjust these manually for macOS or Linux. Open the debug configuration "Debug DBeaver Community" and locate these parameters:

-os
win32
-ws
win32
-arch
x86_64

You may need to replace them. Eclipse debug configurations automatically use the correct arguments. Open the Eclipse debug configuration you created while following Develop in Eclipse, and press Show Command Line. This action opens a dialog window containing the necessary arguments. Copy these arguments and paste them into the IDEA debug configuration.

Troubleshooting

If you encounter problems, do not hesitate to double-check your configuration and try again. If you're still experiencing issues, feel free to ask for help at tickets.

Did we resolve your issue?