This wiki does not contain official documentation and is currently deprecated and read only. Please try reading the documentation on the Liferay Developer Network, the new site dedicated to Liferay documentation. DISCOVER Build your web site, collaborate with your colleagues, manage your content, and more. DEVELOP Build applications that run inside Liferay, extend the features provided out of the box with Liferay's APIs. DISTRIBUTE Let the world know about your app by publishing it in Liferay's marketplace. PARTICIPATE Become a part of Liferay's community, meet other Liferay users, and get involved in the open source project. « Torna a Plugins SDK
Plugin to extend a plugin
For Liferay plugins, it is possible to take an existing plugin and create another one that extends the original one keeping your changes separated from the plugin source code.
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
- Copy inside of the root folder of your new plugin the original WAR of the plugin you want to extend (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) 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:
dsanz@host:~/sdk/portlets/my-social-networking-portlet$ ant war
Buildfile: /home/dsanz/sdk/portlets/my-social-networking-portlet/build.xml
compile:
merge:
[mkdir] Created dir: /home/dsanz/sdk/portlets/my-social-networking-portlet/tmp
[mkdir] Created dir: /home/dsanz/sdk/portlets/my-social-networking-portlet/tmp/WEB-INF/classes
[mkdir] Created dir: /home/dsanz/sdk/portlets/my-social-networking-portlet/tmp/WEB-INF/lib
merge-unzip:
[unzip] Expanding: /home/dsanz/sdk/portlets/my-social-networking-portlet/social-networking-portlet-6.1.10.1-ee-ga1.war into /home/dsanz/sdk/portlets/my-social-networking-portlet/tmp
[copy] Copying 2 files to /home/dsanz/sdk/portlets/my-social-networking-portlet/tmp
[mkdir] Created dir: /home/dsanz/sdk/portlets/my-social-networking-portlet/docroot/WEB-INF/classes
...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.
35279 Visualizzazioni