EzyPlatform Plugin Development Quickstart
Updated at 1787839446000Overview
This post walks through the plugin-specific steps you need to go from a prepared EzyPlatform development environment to a working plugin running on your machine. It's a roadmap for developers who are new to building plugins/themes for EzyPlatform, pulling together the existing detailed guides in the order you should actually follow them.
If you prefer learning by video, check out the EzyPlatform Theme & Plugin Programming course, which follows roughly the same path as this post.
Set up the development environment
Before creating a plugin, prepare your local server, SDK, and IDE by following Set Up an EzyPlatform Development Environment.
Create a plugin
Once the SDK is set up, use the
ezy.sh cp (create project) command to scaffold a new plugin project with the standard structure.For example, to create a project called
hello-world with admin plugin, theme, and web plugin modules:ezy.sh cp hello-world -g com.example -i admin-plugin,theme,web-plugin
After that:
- Import the project into IntelliJ as a Maven project.
- Run
bash export.sh(or.export.bat) to export the modules to your local EzyPlatform server. - Run the
HelloWorldAdminPluginStartupTesttest class to start the server in dev mode. - Go to
http://localhost:9090, log in as admin, and activate the plugin you just created.
Note: In IntelliJ, change the run configuration's working directory to the specific module's folder instead of leaving it at the project root — this is what makes static assets (CSS/JS/images) auto-reload when you edit them.
Detailed guide: Create a plugin
Fix IntelliJ not recognizing path variables (if needed)
On Windows, IntelliJ sometimes fails to pick up environment variables like
EZYPLATFORM_HOME, which breaks the build. If you run into this, work through the following escalating steps and stop as soon as the error is gone:- Create the
EZYPLATFORM_HOMEenvironment variable at the OS level. - Re-declare that path variable in IntelliJ's settings.
- Add the VM option
-Denv.EZYPLATFORM_HOME=/your/pathplus a matching environment variable in your Maven configuration (both for importing and running). - Set it directly in the project-level run configuration, on the startup class itself.
Detailed guide: Fix IntelliJ not recognizing path variable
Learn the plugin project structure
Before writing code, it's worth spending a few minutes reading through the generated project structure so you know where things go. A plugin project typically has these modules:
- admin-plugin: models, controllers, static files, and templates for the admin interface.
- sdk: shared classes used across the other modules.
- socket-app / socket-plugin: handles socket-based communication.
- theme: web theme resources.
- web-plugin: models, controllers, and views for the web-facing side.
Each module follows standard Maven conventions (
src/main/java, src/main/resources), where static/ holds images/CSS/JS and templates/ holds Thymeleaf templates. Two config files matter most: module.properties (module metadata, required for every module except sdk) and menus.properties (admin sidebar menu definitions).
You can also look at the book-store example on GitHub to see how a real plugin is organized.
Detailed guide: The structure of a plugin project
Link a plugin
When your plugin needs to reuse another plugin's API or source code (say, EzyArticle), you "link" that plugin into your project instead of rewriting it from scratch.
Main things to do:
- Make sure EzyPlatform is running, then download the plugin you need (e.g. EzyArticle) from the marketplace and activate it.
- From your project's root directory, run the link command:
ezy.sh link ezyarticle
(on Windows, use
ezy.bat link ezyarticle)- Verify the result: the relevant modules' `pom.xml` files will have the new dependency added automatically, and the linked plugin's package will show up in the
@ComponentsScanof theXxxStartupTestclasses.
Once linked: a linked admin plugin adds menu items to the admin sidebar, a linked web plugin exposes additional APIs you can call, and a linked socket plugin makes its socket controllers available to you.
Note: You need the EzyPlatform SDK installed before you can do this.
Detailed guide: Link a plugin
What's next
After completing these steps, you will have a working plugin running on your local EzyPlatform. From here, you can explore the EzyPlatform CLI commands to manage the server more conveniently, or go deeper with the EzyPlatform Theme & Plugin Programming course.