Child pages
  • Creating Client Plugins

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

Make sure you have selected the correct target against which your project is compiled. It needs to be consistent with the Java version your Servoy install is built against. For this, do check Project > Properties > Java Compiler Node > JDK Compliance Panel.

Package the plugin

...

Right click on the project and choose Export > Java > JAR file.

...

Click Next

Note

You can deselect the .classpath and .project files to avoid polluting your jar with unwanted files only used by Eclipse.

Select the export destination. You may choose to export the jar directly into your /ServoyInstallDir/application_server/plugins directory.

...

Leave the 2 “Export class files…” checked, and check the “Save the description of this JAR in the workspace”. Use the browse button to navigate to your project, and give a name to your definition. Eclipse automatically adds the “jardesc” extension.

Info

What is nice about this option is that the next time you will want to deploy your jar (with modified sources for example), all you will have to do is right-click on the file “xxx.jardesc” in the Package explorer and choose “Create JAR” in the menu, with no need to go through all the Export dialogs each time you change something in your plugin.

Click Next once more. You may leave it as is, or choose other options.

...

titleEntrypoint

Since the class which implements the IServerPlugin, ISmartClientPlugin or IClientPlugin is one file among many inside your jar, you should indicate which file is the plugin entry point.

The plugin jar can use Java Service Provider to expose Servoy Plugin classes. There should be a file inside jar at path: META-INF/services/com.servoy.j2db.plugins.IPlugin which contains a line for each plugin that jar should expose (a class that implements IPlugin). The plugin should also have a default constructor (with no parameters). If file com.servoy.j2db.plugins.IPlugin is missing or contains invalid entries Servoy will scan the jar for all classes that implement interface IPlugin. An example of file content (for mail plugin) is:

Code Block
com.servoy.extensions.plugins.mail.MailServer
com.servoy.extensions.plugins.mail.client.MailPlugin

 

...

Entry Point

Since the class which implements the IServerPlugin, ISmartClientPlugin or IClientPlugin is one file among many inside your jar, you should indicate which file is the plugin entry point.

The plugin jar can use Java Service Provider to expose Servoy Plugin classes. There should be a file inside jar at path: META-INF/services/com.servoy.j2db.plugins.IPlugin which contains a line for each plugin that jar should expose (a class that implements IPlugin). The plugin should also have a default constructor (with no parameters). If file com.servoy.j2db.plugins.IPlugin is missing or contains invalid entries Servoy will scan the jar for all classes that implement interface IPlugin. An example of file content (for mail plugin) is:

Code Block
com.servoy.extensions.plugins.mail.MailServer
com.servoy.extensions.plugins.mail.client.MailPlugin

Package the plugin

  • Right click on the project and choose Export > Java > JAR file.

  • Click Next

    Note

    You can deselect the .classpath and .project files to avoid polluting your jar with unwanted files only used by Eclipse.

    Select the export destination. You may choose to export the jar directly into your /ServoyInstallDir/application_server/plugins directory.

  • Click Next

    Leave the 2 “Export class files…” checked, and check the “Save the description of this JAR in the workspace”. Use the browse button to navigate to your project, and give a name to your definition. Eclipse automatically adds the “jardesc” extension.

    Info

    What is nice about this option is that the next time you will want to deploy your jar (with modified sources for example), all you will have to do is right-click on the file “xxx.jardesc” in the Package explorer and choose “Create JAR” in the menu, with no need to go through all the Export dialogs each time you change something in your plugin.

  • Click Next once more. You may leave it as is, or choose other options.

  • Finish.

Testing the plugin

...