Dependencies and classloading
Hop loads plugins from folders at runtime, which means dependency management is not only a Maven concern: where a jar lands decides which classloader sees it, and that decides whether your plugin works.
Managing Hop dependency versions
Import org.apache.hop:hop-bom in your project’s dependencyManagement to align Hop artifact versions.
Set the hop.version property to the Hop version you use.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-bom</artifactId>
<version>${hop.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
Then declare the dependencies you need without individual versions, including hop-core, hop-engine, and hop-transform-* artifacts such as hop-transform-calculator.
For a plugin running inside Hop, use provided scope for Hop dependencies supplied by the host rather than bundling another copy.
<dependencies>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-engine</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hop</groupId>
<artifactId>hop-transform-calculator</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
The BOM is generated automatically from the reactor during normal CI and release builds and manages Hop library JARs, including plugin JARs, without requiring consumers to activate a profile.
POM artifacts, distribution ZIPs such as hop-client, and build/test tooling such as hop-config-doc are not managed.
Sources, Javadoc and test classifiers are not managed.
The BOM manages versions; importing it does not add dependencies, package jars, or change runtime classloading or plugin visibility.
Declaring a dependency on another plugin does not by itself make that plugin’s classes visible at runtime.
hop-libs provides separate third-party dependency management and is not imported by hop-bom.
See Building and testing for BOM generation and publication.
The layout
lib/core-
Shared by everything. One classloader, the parent of all plugin classloaders.
lib/jdbc-
JDBC drivers, kept apart because most of them cannot ship with Hop for licensing reasons.
DatabasePluginTypeadds this folder as an extra library folder;HOP_SHARED_JDBC_FOLDERScan change it. plugins/<category>/<plugin>/-
The plugin jar, with its private dependencies in a
lib/subfolder next to it.
Each plugin gets its own URLClassLoader over its own jar and its lib/, with the Hop classloader as parent — so a plugin sees lib/core, but lib/core never sees a plugin.
How Maven scope decides placement
The shared assembly component assemblies/shared/hop-plugin-libs.xml routes by scope:
| Scope | Where it lands |
|---|---|
|
|
|
The plugin’s own |
|
|
This is why the scope you pick in a plugin pom is a packaging decision, not just a compilation one.
Two rules
- Never ship a jar that is already in
lib/core -
The plugin classloader would find the parent’s copy anyway, so the second copy is dead weight at best. At worst the two versions differ and behaviour depends on which classloader asked.
tools/find_duplicate_jars.shfinds these.
tools/check-assembly-jar-versions.py reads the client assembly zip and reports a library that landed in more than one version.
Two versions in lib/core share a classloader, so which one loads depends on classpath order.
A plugin that ships a different version loads that copy for itself, because the plugin classloader looks at its own jars first, while the rest of Hop still sees lib/core.
- Plugins that must see each other’s classes share a
classLoaderGroup -
A database dialect and its bulk loader, a VFS provider and its metadata type, an SFTP connection and the actions using it. Without it, an object created by one classloader will not cast to the class the other one knows — the failure looks like an impossible
ClassCastExceptionbetween two identically named classes.
The plugin manifest
Every plugin zip carries a record of what it installs: plugins/<category>/<plugin>/plugin-manifest.json, next to version.xml.
A module whose zip only fills lib/core, such as hop-misc-naming or hop-misc-static-schema, carries the same record as lib/core/<artifactId>-manifest.json.
The client describes its own base the same way, in lib/core/hop-client-manifest.json: the jars hop-core, hop-engine, hop-ui and hop-ui-rcp bring along, and the SWT jars, but not the plugins it bundles (their own manifests describe those).
The build generates it by inspecting the finished zip, so it can never disagree with what actually ships: the routing above stays the only place that decides placement, the manifest just writes the outcome down.
For every file in the zip it records the location (PLUGIN, PRIVATE, SHARED for lib/core, JDBC, or OTHER for things like sample projects), the Maven coordinates and scope when the build could resolve them, the size and a SHA-256.
Around that it lists:
pluginIds-
The ids the module registers, per annotation (
Transform,Action,DatabaseMetaPlugin,HopMetadata, …), read from the jar’s Jandex index. requiresArtifacts/requiresFolders-
The other Hop modules the plugin compiles against, and the plugin folders its
dependencies.xmlputs on its classpath. When the two disagree, one of them is probably wrong — a compile dependency the plugin never uses, or a runtime folder nobody declared. notShipped-
Direct dependencies that are declared but deliberately not in the zip, such as a proprietary JDBC driver the user has to supply.
The generator is org.apache.hop.core.plugins.manifest.PluginManifestGenerator.
The build runs it with the goal hop:manifest of org.apache.hop:hop-maven-plugin (module maven-plugin) right after the assembly step (root pom, profile assembly); aggregate assemblies set hop.manifest.skip=true.
A plugin built outside the Hop repository binds the same goal, see Plugin manifest.
The manifest is added without rewriting the zip: the other entries keep their bytes and the manifest takes their time, so with project.build.outputTimestamp every build gives the same zip.
It warns when a jar’s scope and location disagree, for example a provided dependency that ended up in a private lib/.
To see what a plugin shipped, read its manifest — target/plugin-manifest.json after a build, or the copy inside the zip.
The manifest is what lets an installation reason about shared jars: a lib/core jar can only go when no remaining manifest, the client’s base or a plugin’s, still lists it.
org.apache.hop.core.plugins.manifest.PluginManifestScanner reads every manifest of an installation and maps each file to the manifests that claim it.
Size
tools/check-assembly-size.sh runs in CI and fails the build when the packages get too large; ASF Artifactory rejects uploads over roughly 850 MB.
Adding a heavy dependency to a widely-used module is a distribution-wide cost.
|
This page is a scaffold. Still to write:
|