Phenomenon:
Today, my colleague asked me a question, that is, he built a portlet for the MAVEN project, named Inter-portlet-communication-test, and then maven packs the $liferay_ There's one more file called Inter-portlet-communication-test-0.0.1-snapshot.war,
But when run, the widget's directory name under Tomcat's WebApp is always inter-portlet and does not show the communication-test behind it, And whether it's changed to Inter-portlet1-communication-test or Inter-portlet2-communication-test2 is the same.
Analysis:
To solve this problem, we can follow the breakpoint analysis:
First, because we deployed our portlet artifacts to the $liferay_home/deploy directory through the maven Liferay:deploy command, So this triggers the execution of the Portletautodeploylistener deploy method:
public void Deploy (file file, String context) throws Autodeployexception {if (_log.isdebugenabled ()) {
_log.debug ("Invoking deploy for" + File.getpath ());
} Autodeployer deployer = null; if (ismatchingfile (file, "web-inf/" + Portal.portlet_xml_file_name_standard)) {Deplo
yer = _autodeployer;
} ... if (_log.isinfoenabled ()) {_log.info ("Copying portlets for" + File.getpath ()); } if (_log.isdebugenabled ()) {_log.debug ("Using deployer" + deployer.getclass (). Get
Name ());
} deployer.autodeploy (file, context); if (_log.isinfoenabled ()) {_log.info ("Portlets for" + file.getpath () + copied SUCCESSFU Lly. "+" Deployment'll start in a few seconds. ");}
Because we have portlet.xml in our widget, we meet the 08-09-line condition, then we print the log, and then we proceed to line 23rd, and we continue with the following:
It will invoke the Autodeploy (File file,string context) method of the Portletautodeployer class:
public void Autodeploy (file file, String context)
throws autodeployexception {
list<string> wars = new Arra Ylist<string> ();
Wars.add (File.getname ());
This.wars = Wars;
try {
Deployfile (file, context);
}
catch (Exception e) {
throw new autodeployexception (e);
}
}