How to start a brand new Plugin - EntandoOldVersions/Entando GitHub Wiki
I want to start a brand new Plugin: entando-plugin-jpmyspecialthingy
- Have the project entando-plugins-parent
- We will assume that
entando-plugin-jpmyspecialthingy
doesn't need any other Plugin to get its job done - 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:
- Call it
<modules>
.....
<module>entando-plugin-jpmyspecialthingy</module>
.....
</modules>
Say you want to use entando-plugin-jpmail as a dependency.
- Open the
pom.xml
ofentando-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>
- Done! Go try some mvn commands :)