How to create portlet using Plugins-SDK and Eclipse

In this article, I’ll teach you to create a portlet as plugin ( portlet plugin is a portlet that will be deployed using separate war file, quite different from ext approach). There are two ways to do this :

  1. Using Liferay’s plugins SDK
  2. Using Eclipse alone.

Let’s start

  1. Using Liferay’s plugins SDK : This approach has some advantages, that Plugins SDK would generate all necessary files(liferay-display.xml,liferay-portlet.xml, portlet.xml, etc) and directory structure for your portlet, so you just need to modify the files to suit your needs.  One disadvantage of this approach is, if you want to compile and create WAR using Plugins SDK’s ant task, you have to follow their directory structure, i.e. there should be folder docroot, and html. Of course you can change this if you want to edit the ant task.I won’t describe the steps again, as it’s already described here . If you use Liferay 5.1.2, don’t forget to replace with the one here. Otherwise you’ll have error.
  2. Using Eclipse alone : with this approach, you don’t need to depend on Plugins SDK. You just need to have Eclipse IDE installed, along with WTP (Web Tools Platform) Plugins. You need WTP plugins to import WAR file from sample portlet, modify the files and add your source, and later export it as a WAR file. Here are the steps ( I assume your Eclipse is ready, with WTP installed) :
  • Download sample portlet that you like. ( If you want to create Struts portlet, you can download the sample from here ).
  • Import the WAR file into Eclipse
  • Resolve dependencies. If you use Tomcat as app server, and your Tomcat already installed Liferay portal, you can create user libraries that includes these directories (and jar files inside these directories) : $TOMCAT_HOME/common/lib, $TOMCAT_HOME/common/lib/ext, $TOMCAT_HOME/webapps/ROOT/WEB-INF/lib

Now, you need to edit some configuration files under your $PROJECT/WebContent as follows :

  • liferay-display.xml : You need to modify this file to categorize your portlet under a category.
  • : You need to modify this file to add library dependencies for your portlet. For example, if your portlet depends on displaytag.jar, you don’t need to add displaytag.jar manually to your $PROJECT_HOME/WebContent/WEB-INF/lib. Instead, you just need to add on your like this :

Don’t forget to add your ‘tag library description’ ( tld ) into this file as well, like this


For struts portlet, you don’t need to add struts.jar into this file.

  • liferay-plugin-package.xml : To give description about your portlet, i.e. license, liferay version, author, etc.
  • liferay-portlet.xml : liferay-specific portlet description.
  • portlet.xml : ‘deployment descriptor’ of the portlet
  • struts-config.xml, tiles-defs.xml ( If you use struts and tiles ). If you use bean:write tag, don’t forget to add resources to your struts-config.xml, for example like this
    <message-resources parameter="content.test.Language" />

    Don’t forget to add your language files(,, Language_*.properties)  under content.test package below your source folder.

  • web.xml : You don’t need to modify this one, except for special case.

Now you’re ready to program your portlet. You don’t need to depend on Plugins SDK to compile and package your portlet into WAR, since you can do this using Eclipse.

Happy programming !

27 comments so far

  1. Tom on

    Have you ever looked into the supposed plugin for eclipse?
    The link to the SourceForge project in the Liferay website is devoid of content.

    Do you know of any such beast?



  2. gaurang on

    that’s superb.. thank you

  3. […] 2. The Describes your plugin, i.e. liferay version, author, etc. You can even configure dependencies to Liferay libraries here instead of putting them manually in your WEB-INF/lib. A bit more information about that you can find here. […]

  4. sarfarajali on

    am working with plugin sdk,
    how can i customize column size,
    I have a column like

    now it takes 75 char of lenght.
    so how can i increase this length
    please share your knowledge.


  5. […] Jubelle,Please refer to this link. I think you might get the solution.Regards,Raja Flag Please sign in to flag this as […]

  6. soft roof convertible car on

    Thanks a lot for sharing excellent informations.
    Your web-site is very cool. I’m in awe of details that you’ve employing this website. It reveals how nicely you understand this subject. Bookmarked this website page, restarted for more articles. You, my friend, ROCK! I ran across simply the info I already searched everywhere and just couldn’t encountered.
    What a great web-site.

  7. atlanta roof repair on

    Fantastic web site. Lots of useful information here. I am sending it to a number of pals ans additionally sharing
    in delicious. And obviously, thanks on your effort!

  8. a house extension on

    Simply wanted to say maintain the excellent job! I’m really enjoying the theme/design from the site. Ever encountered any browser compatibility problems? A number of my blog audience have were not impressed with my blog not operating correctly in Explorer but looks great in Opera. Have you any tips that will help fix this issue? I will be curious to get what blog platform you are utilizing? I’m experiencing some small security problems with my latest blog and
    I would want to find some thing safe. Do you own any solutions?

    Hmm it seems prefer your blog ate my first comment (it had become extremely long)
    therefore i guess I’ll just conclude things wrote and say, I’m thoroughly
    enjoying your site site. I as well am another blog writer but I’m still a new comer to everything. Have any suggestions for novice blog owners? I’d genuinely want
    it. Woah! I’m really loving the template/theme for this blog. It is very, yet effective. Usually it’s tough
    to acquire that “perfect balance” between superb usability and visual appeal.

  9. shqip on

    Hello there, just changed state aware of your blog post post using Live search, determined that it’s really educational.

  10. on

    Hi mates, how is the whole thing, and what you would like to
    say regarding this post, in my view its truly awesome for me.

  11. kays jewelry necklaces on

    Excellent beat ! I wish to apprentice even as you amend your website, how can i subscribe
    for a blog website? The account aided me a applicable deal.

    I were tiny bit acquainted of this your broadcast provided vibrant
    clear concept

  12. car insurance quote on

    Right now it sounds like Expression Engine
    is the top blogging platform out there right now. (from what
    I’ve read) Is that what you are using on your blog?

  13. Johnny on

    Wow! This blog looks just like my old one! It’s
    on a totally different topic but it has pretty much the same layout
    and design. Wonderful choice of colors!

  14. standard insurance on

    Highly descriptive article, I liked that bit.
    Will there be a part 2?

  15. Definitely imagine that which you said. Your favourite reason appeared to be on the net the easiest factor
    to take into accout of. I say to you, I definitely get annoyed even as people
    consider concerns that they just don’t know about.
    You managed to hit the nail upon the top as smartly
    as outlined out the whole thing with no need side-effects , other folks can take a signal.
    Will likely be again to get more. Thank you

  16. Battlefield 4 download on

    Thanks for finally talking about >How to create portlet
    using Plugins-SDK and Eclipse | Portal Development’s Weblog <Liked it!

  17. Excellent weblog right here! Also your web site a lot up very fast!
    What web host are you using? Can I get your associate link
    in your host? I wish my web site loaded up as fast as yours lol

  18. Latasha on

    Hi to every body, it’s my first visit of this blog;
    this weblog consists of remarkable and really excellent data for readers.

  19. Mose on

    It’s a pity you don’t have a donate button! I’d certainly
    donate to this brilliant blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my
    Google account. I look forward to fresh updates and will talk about
    this site with my Facebook group. Talk soon!

  20. Robert on

    Hi would you mind stating which blog platform you’re working with?
    I’m looking to start my own blog soon but I’m having a difficult
    time choosing between BlogEngine/Wordpress/B2evolution and
    Drupal. The reason I ask is because your layout seems different then most blogs and I’m
    looking for something unique. P.S My apologies for getting off-topic but I had to ask!

  21. Hello! This post couldn’t be written any better! Reading this post reminds me of my old room mate!
    He always kept chatting about this. I will forward
    this post to him. Pretty sure he will have a good read.
    Many thanks for sharing!

  22. I got this site from my pal who informed me concerning this web site and at the
    moment this time I am browsing this website and reading
    very informative articles or reviews at this time.

  23. on

    Aw, this was an exceptionally good post. Finding the time
    and actual effort to make a great article… but what can I
    say… I put things off a lot and don’t manage to get nearly anything done.

  24. Read The Facts Now on

    I enjoy, cause I discovered exactly what I used to
    be looking for. You have ended my four day long hunt!
    God Bless you man. Have a nice day. Bye

  25. oil Pulling on

    Use anywhere from one person, you would not mind having bleaching or the consumption oil
    pulling of dark yellow, orange, cinnamon and bubblegum.

  26. zabor ilenta on

    After research just a few of the weblog posts on your website now, and I truly like your manner of blogging. I bookmarked it to my bookmark web site checklist and shall be checking back soon. Pls try my site as properly and let me know what you think.

  27. 美国转运公司 on

    I like reading through an article that will make people
    think. Also, thanks for allowing for me to comment!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: