Develop in IDEA - bobbyiliev/dbeaver GitHub Wiki
Well, this is a tricky part.
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).
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!
- Create some folder where you will clone DBeaver repositories. Note: all repositories must be located in the same folder. For example
dbeaver-ce
. cd dbeaver-ce
git clone https://github.com/dbeaver/dbeaver.git
git clone https://github.com/dbeaver/dbeaver-idea-project.git
- Optional:
git clone https://github.com/dbeaver/dbeaver.wiki.git
(skip it if you do not need WIKI) - Start IDEA->Open. select folder
dbeaver-ce/dbeaver-idea-project
- Now you can see the DBeaver modules structure:
- You can edit the code but you cannot compile it because there are no Eclipse dependencies configured.
- Perform all steps described in the Develop in Eclipse article. Use just cloned
dbeaver-ce/dbeaver
as the source root. - Eventually, you should be able to compile and run DBeaver from Eclipse
- Remember where your Eclipse IDE is located (let's say
eclipse-ide-path
)
- Now we need to add Eclipse dependencies in the IDEA project configuration.
- Open
File->Project structure...
. - Make sure you have the proper project Java SDK configured (Java 11+)
- Go to
Global libraries
. - 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"
- Change the library name to ECLIPSE (name and case are important)
- 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
.
-
- If that is not enough, add all folders in
eclipse-ide-path/plugins/org.jkiss*
. Then manually download and add Mockito and JUnit. - Eventually you will see something like this:
- Now, you should be able to compile the project. Just hit CTRL+F9 and wait.
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.
- Add the launcher config as a jar dependency for module
dbeaver
. Locate the jarorg.eclipse.equinox.launcher_*.jar
in theeclipse-ide-path/plugins/
folder. Like this: - 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:
- Click ok and run the debugger. DBeaver must start. Now you can enjoy debugging in IDEA :)
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.
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.