Creating a plugin to extend other plugin
This is a great feature of Liferay plugins which I come
across. It has been available since 4.3. If you find a plugin that you like but
you would like to modify something, you can create another plugin which extends
the original one keeping your changes isolated from the original one.
In order to create a plugin which extends another, you just
need to follow these steps:
- Create a new empty plugin in the Plugins SDK
- Remove all the auto generated files except build.xml and the docroot folder which should be empty
- Take original WAR of the plugin you want to extend, place outside of docroot folder (for example, social-networking-portlet-6.1.10.1-ee-ga1.war)
- Add the following line to your build.xml inside of the tag <project> in order to reference the original war file you are going to extend.
<property
name="original.war.file"
value="social-networking-portlet-6.1.10.1-ee-ga1.war" />
- Add any files you want to add or overwrite from the original plugin in your plugin (following the same folder structure of your original) and run the ant target merge. Please note that the merge target is called whenever the plugin is compiled. All you have to do is to check the ant output:
- This will generate a plugin (you can find the WAR file in the /dist folder of your plugins SDK) which combines the original one plus your changes.
- Just deploy and see the changes
No comments:
Post a Comment