Create a plugin

Updated at 1742653605000

Installing EzyPlatform

You can find installation instructions here.

Installing EzyPlatform SDK

  1. Download the ezyplatform SDK from the homepage.
  2. Extract the downloaded file, for example to the following path: app/ezyplatform-sdk.
  3. Set the environment variable EZYPLATFORM_SDK to point to the extracted folder:
export EZYPLATFORM_SDK=app/ezyplatform-sdk
  1. Add the SDK's bin folder to the PATH variable to use the ezy.sh tool:
export PATH=$PATH:$EZYPLATFORM_SDK/bin

Example on Linux:

Open the configuration file with the command:

nano ~/.bash_profile

Add the following lines to the file:

export EZYPLATFORM_SDK=app/ezyplatform-sdk
export PATH=$PATH:$EZYPLATFORM_SDK/bin

Save and apply the changes:

source ~/.bash_profile

Example on Windows:

  1. Open Control Panel → System and Security → System.
  2. Select Advanced system settings → Environment Variables.
  3. In the System variables section, click New to add a new variable:
  • Variable name: EZYPLATFORM_SDK
  • Variable value: C:/path/to/app/ezyplatform-sdk
  1. Find the Path variable in the System variables list and click Edit.
  2. Add the path to the SDK's bin folder:
%EZYPLATFORM_SDK%/bin
  1. Click OK to save the changes.

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.

Table Of Contents