Develop and debug DBeaver in IntelliJ IDEA
Well, that's 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 latest Eclipse Java IDE isn't that good and convenient as IntelliJ IDEA.
I personally also prefer to develop in IDEA, mostly because of historical reasons but also because of many really helpful features in it.
Anyhow, here we will try to open DBeaver project in IDEA, write code, compile, run and eventually debug (as Java debugger really rocks in IDEA).
It is quite easy to open the project, see module structure and even compile.
But running/debugging is the most tricky part because it requires Eclipse runtime workspace and only Eclipse IDE can create one (IDEA doesn't support this and nobody can blame JetBrains for that).
So, we'll still need Eclipse to configure workspace for debugger. But once you will do this you will no longer need to run Eclipse (until plugins structure or versions will change).
Opening DBeaver in IDEA
- Create some folder where you will clone DBeaver repositories. Note: all repositories must be located in the same folder. For example
git clone https://github.com/dbeaver/dbeaver.git
git clone https://github.com/dbeaver/dbeaver-idea-project.git
git clone https://github.com/dbeaver/dbeaver.wiki.git(skip it if you don't need WIKI)
- Start IDEA->Open. select folder
- Now you can see DBeaver modules structure:
- You can edit code but you can't compile because there are no Eclipse dependencies configured.
Prepare Eclipse IDE and workspace
- Perform all steps described in Develop in Eclipse article. Use just cloned
dbeaver-ce/dbeaveras sources root.
- Eventually you should be able to compile and run DBeaver from Eclipse
- Remember where you Eclipse IDE is located (let's say
Configuring dependencies and compile
- Now we need to add Eclipse dependencies in IDEA project configuration.
- Make sure you have proper project Java SDK configured (Java 8+)
- Go to
- Create new library
ECLIPSE(name and case are important)
- Click "Add" button. Select folder
- Recent IDEA should add all Eclipse jars as dependencies. But in in some IDEA versions you will also need to add some other folders manually:
- Eventually you see something like this:
- Now you should be able to compile the project. Just hit CTRL+F9 and wait.
Running and debugging
DBeaver is Eclipse RCP and must be started using Eclipse Equinox Launcher bundle. This is a special jar file which resides in Eclipse plugins folder and we need to add it to dependencies directly in order to be able to debug.
- Add launcher config as jar dependency for module
dbeaver. Locate the jar
eclipse-ide-path/plugins/folder. Like this:
- Open debug configuration "Debug DBeaver Community" and change path in parameters
Replace path before
.metadatawith path to your Eclipse workspace. Eventually it should look like this this:
- Click ok and run debugger. DBeaver must start. Now you can enjoy debugging in IDEA :)