Building and Deploying Plugins - Documentation topics on: building and deploying plugins,.

Building and Deploying Plugins

To start developing your own plugin you have to start with a standard dotCMS install. Your install can be checked out from GIT or from the downloaded zip release. You will need to install Apache ANT to use the plugins. Make sure to add 'ant' to your path so you can run it at the command line.

There are two kinds of plugins - compiled plugins, which are traditional dotCMS plugins, and dynamic plugins, which are OSGI bundles that can extend specific areas of dotCMS.

For more information about OSGI plugins, see our page on DynamicPlugins

Compiled Plugins get installed in the plugins directory at the root of the dotCMS. You can checkout one or many plugins within this folder. There is a small example "helloworld" plugin under docs/examples/plugins which can be used as a skeleton.  You can copy it to the plugins directory or if you are checked out from svn use the `svn export` command to copy it without the .svn specific files.

Compiled plugins get built by Gradle to a jar file and placed under dotCMS/WEB-INF/lib. This jar contains all configuration, jsps, files and classes from the plugin. The gradle task to do this is called "gradle deploy-plugins"   The deploy task will merge all plugin configuration in plugin order.  Order is alphanumeric by default but can also be controlled via the plugins.xml file at the root of the plugins directory.  Any plugin not defined in that file will load last in alphanumeric order. 

*Warning: If you run the "gradle deploy" task it will compile all the source code AND deploy plugins as well. So it is actually only necessary to run the "gradle deploy-plugins" command if you are just deploying the plugin code.

The deploy tries to be intelligent in how it merges all config files.  Taking into account plugin load order, as explained above,  it will add or override the configuration to the appropriate files. For example, if a plugin provides a struts path that already exists the other one will be commented out and the plugins action/path will be added to the config.  Not all elements can be overridden.  The task "gradle undeploy-plugins" will remove all plugins and the changes applied to the configuration files. You can also clean the plugins with “gradle clean-plugins”.

*Note: If Gradle is not installed in your development environment, you can use the built-in ./gradlew (for Unix/Linux/Mac) or .\gradlew.bat (for Windows) scripts from our source install. So, in order to deploy plugins, you can run from terminal ./gradlew deploy-plugins.