Sunday 25 September 2016

Liferay Portal 7 - Getting Started Guide - Basic setup of Liferay IDE


It's time to get started with Liferay IDE setup by following below quick steps. This post is for you - if you are new to Liferay Portal, but you already have experience with Java development using Eclipse.

Prerequisite

Download
  • Liferay IDE Eclipse - Download latest. For example, 3.0.0 GA1/liferay-ide-eclipse-windows-x64-3.0.0-ga1-201604280251.zip.
  • Liferay Source and Doc - Go to latest "7.0.x GA" version folder and download source and documentation files. For example, I downloaded "liferay-portal-src-7.0-ce-ga1-20160331161017956.zip" and "liferay-portal-doc-7.0-ce-ga1-20160513171934176.zip" from "7.0.0 GA1" folder.  [This is indeed optional, but always good to attach in IDE for quick reference during development]

Basic Setup of Liferay Portal IDE

Unzip Liferay IDE and Open: First of all, unzip the downloaded "Liferay IDE" and open it using "eclipse.exe". You can see, it opens in "Liferay Workspace" perspective by default. In case, you consider to develop older WAR-style plugins using Liferay Plugins SDK, then you can switch to "Liferay" perspective.

Add Liferay Portal server in IDE and Start:
  • New Liferay Server -> Liferay 7.x -> Specify Liferay Portal Directory + Ensure to add "JDK 8" instead of default JRE here (If you keep JRE 8 here, you may face issues later on, for example, Server Administration in Control Panel will complain to replace JRE with JDK) -> Finish.
  • This would create Liferay server in IDE and show "portal-ext.properties" (which you created during liferay portal setup) underneath created liferay server.
  • Start Liferay portal server and wait until you see "server start up in x ms" message in console. (*** Important note: Ensure you don't have liferay instance already running outside Liferay IDE, otherwise you would get port conflict issue)
  • Awesome, now you should be able to see Liferay portal (http://localhost:8080/) in the browser.

Refer Liferay IDE documentation for more detail.

Optional Bonus Tips

Managing Liferay Module Projects in Liferay IDE: Liferay 7.0 architecture offers modularity via OSGI. That means, different modules, so called OSGI bundles, can have their own lifecycle to start, restart, stop, etc. That can be managed using "Gogo Shell" in IDE. Right-click the started portal in server view and select Open Gogo Shell. For example, one can see list of bundles containing "hello" word using this command - lb -s | grep "hello". See Gogo Shell commands documentation.

Import Liferay Portal Source Code in Liferay IDE: Unzip download liferay portal source code and import it in IDE (File -> Import -> General -> Existing Project into Workspace). This would enable you to refer liferay portal code during development, if require.

Install InstaSearch Plugin in Liferay IDE
  • Help -> Eclipse Marketplace -> Search "InstaSearch" -> Install. After installing this plugin, when you restart IDE for the first time, it would take 5-10 minutes to index all projects which are open in IDE.
  • Window -> Show View -> Other -> General - InstaSearch -> Add in the perspective. Start using this plugin for doing keywords based code search. For example, I want to see where is "ElasticSearch" related code in whole portal's codebase! Well, just ask InstaSearch and get the answer. Really super useful plugin.


What's next?

No comments:

Post a Comment