Liferay the name of the widget deployment to the Web server

Source: Internet
Author: User

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); 
        } 
    }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.