Skip to content

About

A minimal Java 21 Eclipse/OSGi template for DBeaver SQL Editor plugins.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DBeaver SQL Editor Plugin Template

An intentionally small Eclipse/OSGi starting point for a DBeaver SQL Editor plugin. It registers a class with DBeaver's public org.jkiss.dbeaver.sql.editorAddIns extension point and supplies only bundle and editor lifecycle scaffolding.

This is a template, not an SQL feature implementation. It contains no LSP server, SQL parsing or analysis, indexing, diagnostics, MCP integration, database access, or workspace scanning.

Requirements

  • Java 21
  • A local DBeaver installation when compiling or installing the plugin
  • curl, zip, and a POSIX-compatible shell

Set DBEAVER_HOME to the Eclipse directory inside your DBeaver installation and, if necessary, DBEAVER_JAVA to its Java 21 executable. On macOS, a typical setup is:

export DBEAVER_HOME=/Applications/DBeaver.app/Contents/Eclipse
export DBEAVER_JAVA=/path/to/java-21/bin/java

On Linux and Windows installations, point those variables at the equivalent directories/files. DBEAVER_JAVA must be Java 21 (it may be a separate JDK when the DBeaver-bundled runtime is newer). build-local.sh can fall back to java on PATH, but it still requires DBEAVER_HOME/plugins for DBeaver's compile classpath.

Build and install locally

./build-local.sh
./install-local.sh
./uninstall-local.sh

The build script compiles with ECJ and produces a bundle JAR in the temporary directory named by DBEAVER_PLUGIN_BUILD_DIR (default: $TMPDIR/dbeaver-plugin-template-build). The installer publishes that JAR to a temporary p2 repository and installs it through the Equinox p2 director. Restart DBeaver with -clean if the new extension is not discovered. uninstall-local.sh removes the installed bundle through the same p2 director; it does not delete any unrelated DBeaver plugins.

BUNDLE_SYMBOLIC_NAME and BUNDLE_VERSION change the built artifact and p2 installable unit. Normally they should match the values you put in the manifest.

Dependencies

build-local.sh downloads a pinned ECJ compiler from Maven Central. It does not need LSP4J or JSON-RPC for this template because the template has no LSP implementation or LSP bundle requirement. If you are extending the template with an LSP client, set DBEAVER_DOWNLOAD_LSP4J=true to cache the pinned LSP4J and JSON-RPC JARs beside ECJ. That opt-in only downloads the artifacts; you must deliberately add the appropriate OSGi requirements and code.

The versions are constants in build-local.sh, so local builds and CI do not silently float Maven dependency versions. Downloads are cached in DBEAVER_PLUGIN_DEPS_DIR or $TMPDIR/dbeaver-plugin-template-deps.

Customize the template

The defaults are deliberately generic:

  • Java package: org.example.dbeaver
  • bundle symbolic name: org.example.dbeaver
  • activator: org.example.dbeaver.Activator
  • editor add-in: org.example.dbeaver.ui.TemplateSqlEditorAddIn

To rename them, move the Java source directories and update the package statements, then make the same coordinated changes in:

  1. META-INF/MANIFEST.MF: Bundle-SymbolicName, Bundle-Activator, and Automatic-Module-Name.
  2. plugin.xml: the add-in class and id.
  3. Activator.PLUGIN_ID.
  4. Any BUNDLE_SYMBOLIC_NAME value used for local build/install commands.

Keep the extension point unchanged unless you intentionally target a different DBeaver extension API. TemplateSqlEditorAddIn is the hook that DBeaver calls for each SQL editor; add editor-scoped setup in init and release resources in cleanup.

Validation and compatibility

Run the standalone checks with:

./validate.sh

They validate the manifest and plugin.xml, check shell syntax, and reject references to unrelated product code. With DBEAVER_HOME pointing to a real installation, the same script runs an ECJ build smoke test against the actual DBeaver plugin JARs. Without DBeaver it reports that integration check as skipped and exits successfully; a failed requested build is never masked.

DBeaver's public extension point is stable enough for a template, but the concrete DBeaver JAR set is versioned with each distribution. Always run the local build and exercise the plugin in the exact DBeaver version you plan to support. CI deliberately cannot claim integration coverage when it has no DBeaver installation.

Security and scope

The included code neither reads SQL documents nor connects to a database. It does not inspect the workspace, index files, invoke external tools, or access passwords or connection credentials. Features you add later may change that security posture; document and review their permissions separately.

Contributing

See CONTRIBUTING.md. The project is licensed under Apache-2.0. Release notes are in CHANGELOG.md.

About

A minimal Java 21 Eclipse/OSGi template for DBeaver SQL Editor plugins.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages