Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

How to start a brand new Plugin

Matteo E. Minnai edited this page · 11 revisions

How to start a brand new Plugin

Use case

I want to start a brand new Plugin: entando-plugin-jpmyspecialthingy

  1. Have the project entando-plugins-parent
  2. We will assume that entando-plugin-jpmyspecialthingy doesn't need any other Plugin to get its job done
  3. Create a new maven module project under entando-plugins-parent
    • Call it entando-plugin-jpmyspecialthingy
    • Use the entando-archetype-plugin-generic archetype
    • groupId : org.entando.entando.plugins
    • artifactId : entando-plugin-jpmyspecialthingy
    • package : com.mycompany.plugins.jpmyspecialthingy
    • Configure the two additional properties:
      • pluginCode : jpmyspecialthingy
      • pluginName : My Special Thingy
    • Now check the entando-plugins-parent/pom.xml.
      Find:
<modules>
.....
     <module>entando-plugin-jpmyspecialthingy</module>
.....
</modules>

Fine, now please show me how to add some other Plugins as dependencies of mine Plugin

Say you want to use entando-plugin-jpmail as a dependency.

  1. Open the pom.xml of entando-plugin-jpmyspecialthingy and edit:
    You must add all of the following for every Plugin you want to use as a dependency (do not copy-paste blindly. Check the version, at least):
<!-- 
     To properly understand the following comments, remember we are editing the pom.xml for
     entando-plugin-jpmyspecialthingy. 
     Thus, "this Plugin" and "the Plugin" are always referred to entando-plugin-jpuserreg. 
-->

<!-- 
     This is for adding the proper files to a WAR based on Entando, using WAR overlay.
-->
<dependency>
  <groupId>org.entando.entando.plugins</groupId>
    <artifactId>entando-plugin-jpmail</artifactId>
    <version>3.2.0</version><!-- version. Don't remove this comment. -->
    <type>war</type>
</dependency>

<!-- 
     This is for properly compile the sources during the development of the Plugin. 
     Its scope is "provided", thus it will be not included in a WAR based on Entando.
-->
<dependency>
    <groupId>org.entando.entando.plugins</groupId>
    <artifactId>entando-plugin-jpmail</artifactId>
    <version>3.2.0</version><!-- version. Don't remove this comment. -->
    <type>jar</type>
    <classifier>classes</classifier>
    <scope>provided</scope>
</dependency>

<!-- 
     This is used at compile time for the tests.
-->
<dependency>
    <groupId>org.entando.entando.plugins</groupId>
    <artifactId>entando-plugin-jpmail</artifactId>
    <version>3.0.0</version><!-- version. Don't remove this comment. -->
    <type>jar</type>
    <classifier>tests</classifier>
    <scope>test</scope>
</dependency>

Then the dependency must be declared in the component descriptor of the plugin: modify the file entando-plugin-jpmyspecialthingy/src/main/resources/component/plugins/jpmyspecialthingy/component.xml as report below:

<?xml version="1.0" encoding="UTF-8"?>
<component>
  <code>jpmyspecialthingy</code>
  <description>My special thing</description>
    <dependencies>
        <code>jpmail</code>
        <!-- other dependencies here -->
    </dependencies>
...
</component>
  1. Done! Go try some mvn commands :)
Something went wrong with that request. Please try again.