Hippo自定义Essential插件开发:如何添加并自研可安装插件
Hey there! Since you're new to Hippo, let's break down both how to add custom add-ons/plugins and how to develop them from scratch—no jargon overload, promise.
Getting your custom add-on up and running in your Hippo instance is straightforward:
- First, confirm your add-on is packaged correctly—Hippo typically uses
.jarfiles, or sometimes a bundled archive with required metadata. - Navigate to your Hippo CMS Console (usually at
/cms/consolefor local instances). - Find the Add-ons section in the console menu.
- Click Upload Add-on and select your custom add-on file from your machine.
- Follow the on-screen prompts: you may need to confirm dependencies, set configuration parameters, and restart the CMS for changes to take effect.
- After restarting, check the Installed Add-ons list to verify it's active, then start using your new features!
Let's walk through building an add-on from the ground up:
2.1 Prep Your Dev Environment
First, make sure you have Java 8+/Maven installed (Hippo relies heavily on these). Then use the Hippo Archetype to create a base project structure—run this in your terminal:
mvn archetype:generate -Dfilter=org.onehippo.cms7:
Pick the hippo-project-archetype (or the one that fits your use case) to set up your project.
2.2 Define Your Add-on's Scope
Be clear on what your add-on will do—e.g., a custom content editor widget, a new workflow action, or an external service integration. This keeps your development focused and avoids scope creep.
2.3 Create the Add-on Module
In your Hippo project, add a new Maven module (conventionally named like my-custom-addon). Update its pom.xml to include key Hippo dependencies:
- For CMS backend features:
org.onehippo.cms7:hippo-cms-api - For delivery tier (HST) components:
org.onehippo.cms7.hst:hst-core - For workflow extensions:
org.onehippo.cms7:hippo-addon-workflow
2.4 Build the Core Functionality
Depending on your add-on type, here's a quick overview:
- Backend Workflow/Service: Extend Hippo's base classes. For example, a custom workflow action:
public class CustomContentWorkflow extends AbstractWorkflow implements CustomWorkflowInterface { @Override public void markAsReviewed(Node contentNode) throws RepositoryException { // Your custom logic here—update node properties, trigger alerts, etc. contentNode.setProperty("custom:review-status", "approved"); contentNode.save(); } } - Frontend CMS Widget: Use Hippo's Wicket framework (classic) or Angular-based Essentials. For Wicket, extend
Panelto build your UI component. - HST Delivery Component: Extend
AbstractHstComponentto handle request processing and render custom content on your frontend site.
2.5 Add Configuration & Metadata
Hippo needs to recognize your add-on, so:
- Create an
addon.xmlinsrc/main/resources/META-INFto define your add-on's name, version, dependencies, and config parameters. Example:<addon xmlns="http://www.onehippo.org/cms7/addon" name="my-custom-addon" version="1.0.0"> <dependencies> <addon>org.onehippo.cms7:hippo-addon-workflow</addon> </dependencies> <configurations> <configuration name="custom.review.config"> <parameter name="notification.email" type="string" required="false"/> </configuration> </configurations> </addon> - Register backend components (like workflows) in
hippoecm-extension.xmlso Hippo loads them on startup.
2.6 Package & Test
- Run
mvn clean installin your add-on module to package it into a.jarfile. - Upload the jar to your local Hippo instance using the steps in Section 1 to test it.
- Debug issues using Hippo's log files (
logs/cms.logorlogs/hst.log) or your IDE's debugger.
- Always leverage the Hippo core API docs (available in your IDE or bundled with the CMS) for detailed class references—this will save you tons of time when extending base components.
- Test edge cases, like dependency conflicts or invalid config inputs, to make your add-on robust.
- Start small! Build a minimal viable version of your add-on first, then iterate with more features.
内容的提问来源于stack exchange,提问作者Gaurav Mulay

