Splitting Several Portlets found in a Single Plugin into their own PluginSplitting Several Portlets found in a Single Plugin into their own Pluginhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=775543472024-03-28T11:53:11Z2024-03-28T11:53:11ZRE: Splitting Several Portlets found in a Single Plugin into their own PlugDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=775616372016-08-10T04:11:58Z2016-08-10T04:11:58ZWell you must realize that what you're asking for, the different treatment of how Liferay handles portlet ids, that in itself is a request for a hack.<br /><br />I think the one that I outlined will be the only way to pull this off without really tearing into the core.<br /><br /><br /><br /><br /><br />Come meet me at the <strong><a href="https://web.liferay.com/web/events2016/northamerica/home">LSNA!</a></strong>David H Nebinger2016-08-10T04:11:58ZRE: Splitting Several Portlets found in a Single Plugin into their own PlugJP A.https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=775552412016-08-10T02:06:22Z2016-08-10T02:06:22ZThere are some reasons behind the idea of separating those portlets in particular, most of them related to maintenance, code clean up, and individual deployments (according to the processes of the client). I know this can be accomplished without separating them, but there is a lot of highly coupled, duplicated and messy code in the way, all of them as a product of bad practices. Separating them might give us some air to clean them up individualy. Some of those portlets might also be removed in the future, so a bit of anticipated refactoring now might help us later.<br /><br />All that said, you are right. And I was just hoping that there was a way of accomplishing this a without any kind of hack. We will considere you suggestions.<br /><br />Thank youJP A.2016-08-10T02:06:22ZRE: Splitting Several Portlets found in a Single Plugin into their own PlugDavid H Nebingerhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=775567302016-08-10T00:04:03Z2016-08-10T00:04:03ZYeah, portlet ids help track back to their origins; trying to fake ids to look like the y came from one war when they come from multiples may have unknown consequences.<br /><br />The big question is why they need to be split? I mean, often times I recommend joining related portlets into a single plugin to reduce load times, duplicated classes in multiple class loaders, duplicated spring beans across multiple wars, ...<br /><br />In general it's a good thing, so i'm interested in what is driving them to be split apart, if you don't mind sharing...<br /><br />One item you might consider - a service wrapper on PortletLocalService, specifically the getPortletById() methods. You could trap for your old portlet names like <strong>portletA_WAR_SomePortletsportlet</strong> and pass the old portlet name of <strong>portletA_WAR_PortletAportlet</strong> or vice-versa, depending upon what makes more sense. This way the code should be able to find all exising portlet ids and prefs, etc., without changing what the portal is doing.<br /><br /><br /><br /><br />Come meet me at the <strong><a href="https://web.liferay.com/web/events2016/northamerica/home">LSNA!</a></strong>David H Nebinger2016-08-10T00:04:03ZSplitting Several Portlets found in a Single Plugin into their own PluginJP A.https://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=775543462016-08-09T23:01:50Z2016-08-09T23:01:50Z<html><head></head><body><strong>Hello, I need to split a plugin that contains several portlets into several plugins (one per portlet).</strong><br><br><strong>The tricky part is that I need to do this and conserve each one of the original portletids</strong>. When the new portlets plugins are deploy we need to make sure that those portlets remain "the same" since we don't want to have to re-add/configure them in all the sites and pages again.<br><br><strong>To clarify the situation:</strong><br><br><strong>1)</strong> We have a Plugin called SomePortlets-portlet, where we have defined 3 portlets: <strong>portletA</strong>, <strong>portletB</strong>, <strong>portletC</strong>. This results having the fallowing portletids:<br><br>- <strong>portletA_WAR_SomePortletsportlet</strong><br>- <strong>portletB_WAR_SomePortletsportlet</strong><br>- <strong>portletC_WAR_SomePortletsportlet</strong><br><br>(And in tomcat we get <strong>webapps/SomePortlets-portlet</strong>)<br><br><strong>2)</strong> When separating the portlets this is what we get (as expected):<br><br>- <strong>portletA_WAR_PortletAportlet</strong><br>- <strong>portletB_WAR_PortletBportlet</strong><br>- <strong>portletC_WAR_PortletCportlet</strong><br><br>(And in tomcat we get <strong>webapps/PortletA-portlet</strong>, <strong>webapps/PortletB-portlet</strong>, <strong>webapps/ PortletC-portlet</strong>)<br><br>Now, we would like to get the same portletids from point<strong> 1)</strong>, but I'm not sure if that's posible.<br><br><strong>Some attempts:</strong><br><br><strong>1)</strong> Changed the project name for each plugin (PortletA-portlet, PortletB-portlet, PortletC-portlet) in <strong>build.xm</strong>l to SomePortlets:<br><br><pre><code>
<project name="SomePortlets-portlet" basedir="." default="deploy">
<import file="../build-common-portlet-test.xml" />
</project>
</code></pre><br><br>This works for having a single portlet deployed correctly (it keeps the same portlet id), but the problem comes when deploying other the other plugins since each will override the next given that they have the same webpp name: SomePortlets-portlet<br><br><strong>2)</strong> Kept the change from point 1) and updated the <strong>recommended-deployment-context</strong> in <strong>liferay-pluing-package.properties</strong>:<br><br><pre><code>recommended-deployment-context=PortletA/SomePortlets-portlet</code></pre><br><br>I see that the liferay deployment process correctly creates the webapp in <strong>webapps/PortletA/SomePortlets-portlet</strong>, however it seems like tomcat does not load the app.<br><br>The logs shows <strong>Portlets for ....w