1

I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant. The setup for Netbeans IDE is the following

  1. Go to the directory \portlets
  2. Run the create.bat (or sh file depending on the OS) to create a new sample portlet
  3. Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet

That's it, pretty simple.

For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.

I didn't also find great tutorials on the web... Could someone help me with this, pointing out online tutorials or give me some hints.

Thanks

gamerson
  • 5,220
  • 1
  • 28
  • 45
Juri
  • 32,424
  • 20
  • 102
  • 136

5 Answers5

3

I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:

ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create

Than cd into the directory of your created portlet an do:

ant setup-eclipse

After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.

Lorgarn
  • 136
  • 1
  • 15
  • Hi, thanks for your post. I actually used Netbeans..Can never be bad to see another environment too, but then during development I recognized the ant option for setting up also the environment for Eclipse, so next time maybe :) And yes, I'm developing (or developed, I'm finished now) a portlet according to the JSR specifications together with Spring, Hibernate etc.. I'll mark your answer as accepted 'cause it is actually the solution, I just didn't make it to post the answer myself earlier :) – Juri Jun 12 '09 at 10:24
2

Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:

Liferay IDE Installation Guide

Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.

Getting Started Tutorial

Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.

Importing existing Projects

gamerson
  • 5,220
  • 1
  • 28
  • 45
1

you can find the tutorial for deploying liferay in eclipse

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)

Nifle
  • 11,745
  • 10
  • 75
  • 100
naveen
  • 1,451
  • 6
  • 21
  • 27
0

As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.

We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.

You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.

The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.

John P. Fisher
  • 267
  • 1
  • 6
0

No clue about Liferay's specifics, but in general, I'd do this:

  1. Follow the steps 1 and 2 from your NB setup list
  2. Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
  3. Import the contents of sample portlet directory by doing Import -> File system in Eclipse
  4. Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
  5. Adjust classpath of the project, point it to LR lib folders, ...
  6. If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
david a.
  • 5,283
  • 22
  • 24