Create a plugin

Updated at 1710152881000

Installing EzyPlatform

You can find installation instructions here.

Installing EzyPlatform SDK

  1. Download the EzyPlatform SDK here.
  2. Unzip the downloaded SDK, for example, into the directory: app/ezyplatform-sdk.
  3. Set up the EZYPLATFORM_SDK environment variable to point to the directory app/ezyplatform-sdk.
  4. Add the $EZYPLATFORM_SDK/bin directory to the PATH environment variable, so you can use the ezy.sh tool.

Building necessary libraries

Make sure you have already installed apache maven before.

  1. Clone the ezyplatform-development repository.
  2. Navigate to the cloned ezyplatform-development directory and run the command: bash build.sh or .\build.bat for windows.

Creating a plugin project

  1. Move to the directory containing your projects.
  2. You can run the command: ezy.sh and see the project creation guide as follows:
create, create-project, cp, -cp <project name> 
    -g <group name, example: com.your_company> 
    -p [package name, example: com.your_company.my_project] 
    -v [version, example: 1.0.0] 
    -i [inclusive modules: *,admin-plugin,socket-app,socket-plugin,theme,web-plugin] 
    -e [exclusive modules: admin-plugin,socket-app,socket-plugin,theme,web-plugin] 
    -a [author] 
    -o [output directory]: to create a project

Let's say you want to create hello-word project with 3 modules are admin-plugin, theme and web-plugin with groupId is com.example you can run the bellow command:

For linux
ezy.sh cp hello-world -g com.example -i admin-plugin,theme,web-plugin
For windows
ezy.bat cp hello-world -g com.example -i admin-plugin,theme,web-plugin

Running the plugin project

Make sure you're using Java 8.

Suppose you have just created a project named hello-world.

  1. Navigate to the hello-world directory.
  2. Import the hello-world project into IntelliJ IDE. Note that if your IntelliJ does not recognize the EZYPLATFORM_HOME path variable, you may need to follow the instructions to fix the IntelliJ not recognizing the path variable.
  3. Run the command: bash export.sh to export the project components to EZYPLATFORM_HOME.
  4. Locate the HelloWorldAdminPluginStartupTest file in the hello-world-admin-plugin module within the src/test/[package name]/ directory.
  5. Run this file.
  6. Open a web browser and access the URL: http://localhost:9090 - this is the admin interface.
  7. In the admin interface, navigate to Plugins/Admin, find the hello-world plugin, and activate it.
  8. Restart HelloWorldAdminPluginStartupTest.
  9. Additionally, if you want to start socket-app, socket-plugin, theme, or web-plugin, find the corresponding XxxStartupTest classes in their respective directories.

Configuring the working directory on IntelliJ

By default, IntelliJ will have the working directory set to the root directory, for example, hello-world. However, to enable ezyplatform-tools to automatically reload HTML, CSS, JavaScript, or other static files, we need to specify the correct working directory to the module being executed.

  1. In IntelliJ, go to the run section and select Edit Configurations...
  2. In the Working directory section, point it to the corresponding module where the XxxStartupTest file you want to run is located.

If IntelliJ can not recognize path variable, you can look at here to see how to fix.

Exporting a plugin

To publish a plugin on ezyplatform.com or install a plugin for EzyPlatform on your server, you need to navigate to your plugin project, for example, hello-world, and then export it using the command bash export.sh for Linux or export.bat for Windows.

Check the logs and ensure that no errors are thrown. After that, you will have a zip file located in the hello-world/target/project/hello-world.zip directory. You can use this zip file for publishing or installation.

Re-build the plugin on IntelliJ IDE

After export the plugin, you need to re-build the plugin by click to install on the right side of IntelliJ IDE to start the plugin on IDE normally, I don't know why, maybe it's a bug of IntelliJ.

Screenshot 2024-02-15 at 22.36.53.png

Change working directory

By default, IntelliJ will run the project with the root directory. You will need to change the Working directory to the corresponding module in order to use the automatic reload feature of ezyplatform-devtools. Assuming you need to run HelloWorldAdminPluginStartupTest of the module, you will need to change the Working directory as follows:

Screenshot 2024-03-11 at 17.22.30.png

Next step

You can link to difference plugins to reuse features and source code.