« Back to Integrated...

Netbeans IDE Setup

(Redirected from Liferay 5.1.2 and Netbeans 6.5 setup)

This article needs updating. For more information, see Wiki - Need Updating.

This page uses Liferay 5.1 and Netbeans 6.5.

Introduction #

This document covers the setup of Netbeans to be used jointly with the Liferay plugin SDK.

It has been tested against Liferay + plugin SDK v5.1.2 and Netbeans 6.5RC1 (but it should be running with any Netbeans version 6+)

Pre-requisites #

  • A running Liferay server (5.1.2)
  • Netbeans 6.5RC1

Plugin SDK #

Introduction #

The plugin SDK is a Liferay tools which allows development of portlets, themes and hooks by facilitating:

  • creation of projects' structure
  • generation of objects (for exemple service layer class for portlets)
  • compilation of projects
  • deployment

All this operation are done thanks to ANT files made available in the SDK.

Installation #

The plugin SDK available on the download page comes with a little bug which breaks portlets folders structure and therefore throws exceptions during deployment. Therefore, a minor correction needs to be done (this issue has been addresses and already fixed. It will be made available in Liferay 5.2.2, see http://support.liferay.com/browse/LPS-152).

A guide gives a very good introduction (including installation) to the plugin SDK and is available here : http://docs.liferay.com/5.0/official/development-documentation5.pdf.

To install the SDK, download and unzip it, update build.${username}.properties file as described in the PDF file. Then, the portlets.zip files, which provide portlets directory skeleton, needs to be changed by a correct one. On a nix/MacOS machine, proceed as follow:

This operation simply replaces the existing portlet.zip file by the one indicated.

Note that the portlet folder structure differs from the one indicated in the PDF file (page 9). The plugin SDK is now ready be to used, a simple portlet will be created to show its usage:

  • cd liferay-plugins-sdk-5.1.2/portlets
  • ./create.sh yop 'yop portlets' (or create.bat on Windows. If created.sh does not run, do a 'chmod +x create.sh' to make executable).

The portlet is now created. To compile and deploy it :

  • cd yop-portlets
  • ant deploy (the "deploy" ant task depends on "compile", so both actions are done)

If you have a running Liferay server, you should see that the portlet has been correctly deployed (check the log file), and it should be available from the portal itself (install it to see). If you update the code (for instante the view.jsp page), you can issue a new 'ant deploy' and reload the webpage to see the update.

Plugin SDK advanced usage #

The plugin SDK comes with advanced tools for generating data model and related Java objects, which make this tool a powerful one. See the doc page 18 (http://docs.liferay.com/5.0/official/development-documentation5.pdf) for more details. If you decide to test it by doing the example, do not forget to import relevant packages in the BookLocalServiceImpl class:

import com.sample.portlet.library.service.base.BookLocalServiceBaseImpl;
import com.sample.portlet.library.model.Book;
import java.util.Date;
import com.liferay.counter.service.CounterLocalServiceUtil;
import com.liferay.portal.service.persistence.UserUtil;
import com.liferay.portal.model.User;

Netbeans #

Netbeans offers portlets development thanks to the portal-pack plugin (http://portalpack.netbeans.org). While being a very nice plugin, it does not generated Liferay specific configuration files : liferay-plugin-package.properties, liferay-portlet.xml and liferay-display.xml (UPDATE: it does now, please see 'update' at the end of this page).

Please note : this document shows a way of using Netbeans and Liferay plugin SDK. Other solution could give same results.

It is recommended to use the portal-pack plugin for the portlet dev but not for the portlet creation: for the creation, the create.sh script file from the plugin SDK. Once the portlet has been created, start Netbeans a create a new project:

  • projet type: Java Web / java application with existing sources
  • select the location of the portlet you created with the plugin SDK.

Netbeans will indicate that a build script exists and will propose to create its own as nbbuild.xml, accept that.

A this point, you have a porlet project with unresolved references to Java objects. From Netbeans, create a new library (tools/Libraries) and include there all Liferay related JAR files.

You can now include tools provided by Netbeans and more specifically by the portal-pack plugin. Go the the project properties page, click 'Frameworks' and there include the "Portlets framework" if you wish.

Final steps:

  • web.xml file must be empty (otherwise Liferay will not accept to deploy the portlet): open the one created and remove everything which stands inside the 'webapp' opening and closing tag;
  • in order to compile and deploy your portlet, the build ANT script provided by the plugin SDK is prefered to the one made available by Netbeans. Go to files, and select 'deploy' in the build.xml file. You can even add a keyboard shortcut (I use F2 for that) for easy compilation/deployment of your portlet.

Note: Netbeans offers to run Tomcat inside the IDE, you can choose to do so or let it run inside a terminal window outside of the IDE.

Conclusion #

This option gives the opportunity to use the power of the two tools.

UPDATE (12/11/2008): a new version of PortalPack plugin for Netbeans has been released and provides new Liferay related features. It might be used to develop portlets without the Liferay plugin SDK. See more at http://portalpack.netbeans.org.

0 Attachments
35666 Views
Average (1 Vote)
Comments

Showing 12 Comments

Alban KOM.
11/12/08 9:30 AM

Great !!!!!!!!!!!!!!!!!

Sohui Gu
11/12/08 6:17 PM

very good!

Alberto Gallardo
10/11/10 1:06 AM

The link to the guide is not working (http://docs.liferay.com/5.0/official/development-documentation5.pdf).

Malek Tarboush
11/26/10 11:09 AM

The portal pack 3.0.4 is broken liferay 6.0.5
in case anyone use it
follow the solution steps here

http://ranjansatya.wordpress.com/2010/09/22/portal-pack-3-0-4-service-builde­r-plugin-is-broken-with-liferay-6-0-5/

freugg freugg
9/4/11 8:44 PM

ft within the boots; the heel also expectations to become comfortable to say no the hurts ugg boots sale brought on ugg australia sale with the ugg australia uk frictionA ugg australia woman wearing high-heeled shoes can be sexy, self-assurance, and charming breaking ugg australia out in an instant, she is ugg boots uk flicking while wringing waistSheepskin boots ugg australia sale uk are for both, men and ugg boots uk womens bootsFor a ugg boots uk sale lot of people, cheap price always what they seek, ugg boots sale after ugg boots uk sale financial crisis, it ugg boots sale uk becomes necessity ugg boots uk for people to find discount products ugg boots sale uk prepare for ugg boots sale winter The instead straightforward rationale being, these a massive ugg boots uk amount of girls boots UGG in no way warmed the ft neither current any comforts Uggs ugg australia sale come ugg australia uk sale in more basic, classic colors and styles, but for women, ugg boots uk itSustaining dish aside you set up apart fellow ugg boots sale uk member HAS strolled eliminate, a person room in ugg australia sale uk order to dismal background, floor? Knag Thinker stated: [irritably, be ugg boots sale motivated to ooze exhibit near to the Mistakes of Others] react oneselfEveryone would like to ugg australia uk purchase ugg boots sale uk entities that in higher top quality and reduced ugg boots sale uk amount impacto de ugg boots sale los hombres ugg boots sale uk s l If ugg boots uk

freugg freugg
3/15/12 11:03 PM

<P><a title="chi official website" href="http://www.goodflatiron.com" target=_blank>chi official website</a> <a title="NFL Jerseys Cheap" href="http://www.cheapjerseysauthentics.us" target=_blank>NFL Jerseys Cheap</a> <a title="Derek Fisher Jersey" href="http://www.officiallakersjerseysshop.com/derek_fisher_authentic_jersey" target=_blank>Derek Fisher Jersey</a> Pressure <a title="Beats By Dre Headphones" href="http://www.beatscity.com" target=_blank>Beats By Dre Headphones</a> relief valve <a title="Rondo Celtics Jersey" href="http://www.officialcelticsjerseysshop.com" target=_blank>Rondo Celtics Jersey</a> <a title="Beats By Dre" href="http://www.beatscity.com" target=_blank>Beats By Dre</a> <a title="CHI Hair Straightener website" href="http://www.goodflatiron.com" target=_blank>CHI Hair Straightener website</a> <a title="Authentic Pau Gasol Jersey" href="http://www.officiallakersjerseysshop.com/pau_gasol_authentic_jersey" target=_blank>Authentic Pau Gasol Jersey</a> A <a title="Wholesale NFL Jerseys" href="http://www.cheapjerseysauthentics.us" target=_blank>Wholesale NFL Jerseys</a> pressure <a title="NHL Jerseys China" href="http://www.cheapjerseysauthentics.us" target=_blank>NHL Jerseys China</a> relief <a title=www.goodflatiron.com href="http://www.goodflatiron.com" target=_blank>www.goodflatiron.com</a> valve <a title="Andrew Bynum Jersey" href="http://www.officiallakersjerseysshop.com/andrew_bynum_authentic_jersey" target=_blank>Andrew Bynum Jersey</a> is <a title=www.beatscity.com href="http://www.beatscity.com" target=_blank>www.beatscity.com</a> a <a title="Beats By Dre Outlet" href="http://www.vipmonsterbeats.com" target=_blank>Beats By Dre Outlet</a> safety device <a title="Cheap Beats By Dre" href="http://www.beatscity.com" target=_blank>Cheap Beats By Dre</a> that relieves <a title=www.officialheatjerseysshop.com href="http://www.officialheatjerseysshop.com" target=_blank>www.officialheatjerseysshop.com</a> in <a title=www.cheapjerseysauthentics.us href="http://www.cheapjerseysauthentics.us/" target=_blank>www.cheapjerseysauthentics.us</a> case <a title="monster beats" href="http://www.beatscity.com" target=_blank>monster beats</a> of overpressure <a title="Cheap NHL Jerseys" href="http://www.cheapjerseysauthentics.us" target=_blank>Cheap NHL Jerseys</a> in <a title=www.officialcelticsjerseysshop.com href="http://www.officialcelticsjerseysshop.com" target=_blank>www.officialcelticsjerseysshop.com</a> a vessel <a title="Cheap Beats By Dre" href="http://www.vipmonsterbeats.com" target=_blank>Cheap Beats By Dre</a> or pipingspot, elasticity <a title="Beats By Dre Sale" href="http://www.vipmonsterbeats.com" target=_blank>Beats By Dre Sale</a> and <a title="Kobe Bryant Jersey" href="http://www.officiallakersjerseysshop.com" target=_blank>Kobe Bryant Jersey</a> massIt was <a title="Beats By Dre" href="http://www.vipmonsterbeats.com" target=_blank>Beats By Dre</a> then <a title="Cheap Jerseys From China" href="http://www.cheapjerseysauthentics.us" target=_blank>Cheap Jerseys From China</a> that <a title="Cheap Jerseys China" href="http://www.cheapjerseysauthentics.us" target=_blank>Cheap Jerseys China</a> I <a title="cheap monster beats" href="http://www.beatscity.com" target=_blank>cheap monster beats</a> became more <a title="James Heat Jersey" href="http://www.officialheatjerseysshop.com" target=_blank>James Heat Jersey</a> of <a title=www.officiallakersjerseysshop.com href="http://www.officiallakersjerseysshop.com" target=_blank>www.officiallakersjerseysshop.com</a> an <a title="Beats By Dre Sale" href="http://www.beatscity.com" target=_blank>Beats By Dre Sale</a> open <a title=www.cheapjerseysauthentics.us href="http://www.cheapjerseysauthentics.us" target=_blank>www.cheapjerseysauthentics.us</a> networker <a title="Beats By Dre Cheap" href="http://www.vipmonsterbeats.com" target=_blank>Beats By Dre Cheap</a> but <a title="Kobe Bryant Lakers Jersey" href="http://www.officiallakersjerseysshop.com" target=_blank>Kobe Bryant Lakers Jersey</a> no where <a title="Rajon Rondo Celtics Jersey" href="http://www.officialcelticsjerseysshop.com" target=_blank>Rajon Rondo Celtics Jersey</a> near the <a title="CHI Hair Straightener official website" href="http://www.goodflatiron.com" target=_blank>CHI Hair Straightener official website</a> strategy of <a title="Wholesale NBA Jerseys" href="http://www.cheapjerseysauthentics.us" target=_blank>Wholesale NBA Jerseys</a> a LION, which <a title="Rajon Rondo Jersey" href="http://www.officialcelticsjerseysshop.com" target=_blank>Rajon Rondo Jersey</a> is <a title="CHI Hair Straightener" href="http://www.goodflatiron.com" target=_blank>CHI Hair Straightener</a> stands <a title="LeBron James Heat Jersey" href="http://www.officialheatjerseysshop.com" target=_blank>LeBron James Heat Jersey</a> for <a title="cheap monster beats" href="http://www.vipmonsterbeats.com" target=_blank>cheap monster beats</a> LinkedIn Open <a title="Authentic Ron Artest Jersey" href="http://www.officiallakersjerseysshop.com/ron_artest_authentic_jersey" target=_blank>Authentic Ron Artest Jersey</a> Networker</P>
<P></P><a title=www.vipmonsterbeats.com href="http://www.vipmonsterbeats.com" target=_blank>www.vipmonsterbeats.com</a>

freugg freugg
3/15/12 11:04 PM

<a href="http://www.baidu.com">百度</a>
sina
[URL="http://www.baidu.com"]baidu[/URL]
[UR­L=www.google.com]google[/URL]
[link=http://www.yahoo.com]yahoo[/link]
[A/]http://w­ww.yahoo.com[a]yahoo[/A]

meng meng
3/18/12 8:36 PM

<a href="http://www.baidu.com">baidu</a>
<a href='http://www.sina.com'>sina</a>
[URL="http://www.baidu.com"]baidu[/URL]
[URL=w­ww.google.com]google[/URL]
[link=http://www.yahoo.com]yahoo[/link]
[A/]http://w-ww­.yahoo.com[a]yahoo[/A]

meng meng
3/18/12 8:37 PM

<a href="http://www.baidu.com">baidu</a>
<a href=http://www.sina.com>sina</a>
[URL="http://www.baidu.com"]baidu[/URL]
[URL=www­.google.com]google[/URL]
[link=http://www.yahoo.com]yahoo[/link]
[A/]http://w-ww.y­ahoo.com[a]yahoo[/A]

meng meng
3/18/12 8:40 PM

<a href='http://www.beatsbydremusic.com'>Cheap Beats By Dre</a>