A number of “seed” plugins are provided in the plugin-seeds repo in the corporate dotCMS Github repository. These examples provide example code to create the most common types of plugins for dotCMS and show the breadth of what you can do with dotCMS plugins.
Additionally, dotCMS has a github repo dedicated to various working plugin examples. This is a good source of information and most provide concrete functionality that is easy to replicate and understand.
⚠️ Note: All example plugins are presented as just that — examples. Plugins, even those that are developed by dotCMS, live outside of the dotCMS core system and are not supported by dotCMS without an additional OSGi support engagement. dotCMS Plugins are made available as examples; are not guaranteed to work; and are updated “lazily”, or as needed, by dotCMS staff.
Begin by cloning the relevant plugin repository. For example, let's use the OWASP Encoder repo. Next, run the gradle scripts to constitute the
gradlew jar. The results will appear within in the local clone under
Note: Your IDE of choice may have a plugin, such as IntelliJ's Gradle Tool or Eclipse's Gradle Integration, to assist behind the scenes with some of the minutiae of Gradle wrapper scripts, automatically handling certain hitches. If you find yourself encountering errors when building the project through your local terminal, attempting the build via these tools may prove the quickest solution.
Upload and deploy the resultant JAR file — in this case
com.dotcms.owasp.encoder-0.2.jar — via the admin panel under Dev Tools → Plugins.
Alternately, you can load the JAR file headlessly through an API call; simply
POST to the
/api/osgi endpoint, such as in the example below:
curl -X POST -u email@example.com:admin -H "Content-Type: multipart/form-data" -F "file=@/com.dotcms.owasp.encoder-0.2.jar" https://demo.dotcms.com/api/osgi
dotCMS Provided Examples
- dotZapier Plugin (various web application integrations)
- OWASP Encoder Plugin
- Add Rewrite Rule Plugin
- Content Hook / ContentAPI Interceptor Plugin
- Custom Admin Portlet Plugin
- Custom Velocity Viewtool Plugin
- Custom Workflow Action Plugin
- Fragment/Exported Packages Plugin
- OAuth Authentication Plugin
- OSGi Services Plugin
- Override a dotCMS Class Plugin
- Actionlet — Rules plugin
- Conditionlet — Rules plugin
- Scheduled Quartz Job Plugin
- Static Push Publishing Plugin
- Third Party Jars and Libraries Plugin