Skip to end of metadata
Go to start of metadata

Introduction

Below are described 2 ways to create a plug-in project:

  • manually
  • maven archetype

Creating a project from an archetype is faster and more convenient. We only need to complete the required parameters such as name, key etc.


Creating a project from scratch 

Each created plug-in can not share one package with another plug-in.

 

  1. We create a new Maven project (File -> New -> Maven Project).
  2. Select the Create a simple project option (skip archetype selection)and click Next
  3. We complete the information about the project and create the project




    Project parameters

    The project should be created in accordance with the convention:

      • groupId: com.suncode.plugin accepted for plugins
      • artifactId: plug ID (must be universal)
      • version: the plugin version can be independent from the target system version
      • packaging: must be set to bundle (the value is not on the list)

     

    We add the necessary suncode-plugin.xmldescriptor file to the src/main/resources directory: 

    suncode-plugin.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin key="${project.groupId}-${project.artifactId}" name="Tutorial Plugin">
    	<plugin-details>
    		<description>
    			<localized language="en">Description</localized>
    			<localized language="pl">Opis</localized>
    		</description>
    		<author>Suncode</author>
    	</plugin-details>
    	
    	<!-- I18N -->	
    	<i18n key="i18n-bundle" location="locale/messages" />
    	
    	<!-- Web MVC -->
    	<web-mvc key="mvc" />
    </plugin>

    The suncode-plugin.xmlfile is filtered by Maven. This means that the contents of these properties are dynamically inserted into the properties of ${...}.

    Instead of ${project.groupId} - ${project.artifactId} we can enter a permanent ID of the plugin. Typing ${project.groupId} - ${project.artifactId} results in a dynamically created identifier from the groupId and artifactId properties.

  4. We add the messages.properties file to the src/main/resources/locale directory. 

 

The final structure of the project should look like this:

Creating a project using a prepared archetype

 

Before creating the project, you need to configure the archetype catalogs. To do this, open Window-> Preferencesand add the Remote Catalogwith the URL of the Suncode repository http://192.168.1.51:8081/nexus/content/groups/public/


 

 

  1. We create a new Mavenproject (File -> New -> Maven Project).
  2. Leave the Create a simple project (skip archetype selection) option selected
  3. We choose the archetype we are interested in as in the picture:




  1. Then we fill-in all the required information: 



    Properties

    Description of all properties:

      • plusworkflowVersion: the target version of thePlusWorkflow system
      • name: name of the plugin
      • author: creator of the plugin
      • descriptionPL: description of the plugin in Polish
      • descriptionEN: description of the plugin in English
  2. Created project can already be installed in the system as a plug-in. The descriptor for this plug-in looks like this:

    suncode-plugin.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin key="com.suncode.plugin-tutorial" name="Tutorial Plugin">
    	<plugin-details>
    		<description>
    			<localized language="en">Description</localized>
    			<localized language="pl">Opis</localized>
    		</description>
    		<author>Suncode</author>
    	</plugin-details>
    	
    	<!-- I18N -->	
    	<i18n key="i18n-bundle" location="locale/messages" />
    	
    	<!-- Web MVC -->
    	<web-mvc key="mvc" />
    </plugin>

 

The final structure of the project should look like this:

 


 



 

  • No labels

0 Comments