Lets start with creating a demo portlet. Follow this link. If you hit any error during creation of portlet like Run-time JRE in invalid (snap).Just delete the server from work-space and create it again.
Note : Create your portlet inside the Plugin SDK folder. As per my setup “E:liferayliferay-plugins-sdk-6.1.0-ce-ga1-20120106155615760portlets” this is the folder to place portlet code,otherwise you won’t able deploy with ant build script.
Deploying Portlet into Liferay.
==> You can manually deploy using the information provided at this link
==> Deploying portlet by using build script. read below
- Right Click on build script and run the “Deploy Task”
- Unfortunately you may hit an error. saying “Task cannot continue because ECJ is not installed“. (snap) .Interesting lets fix it.
- You simply need to put the ecj.jar file into the lib directory of the Ant plugin directory in your Eclipse install
- Go to Window> Preferences> Ant> Runtime > Classpath (snap)
- Add External jar (E:liferayliferay-plugins-sdk-6.1.0-ce-ga1-20120106155615760libecj.jar) , i.e. ecj.jar located under your plugin sdk folder.
- Now Re-run the build script 🙂
Adding Your Portlet to Liferay
Login to liferay account (http://lcoahost:8080), remove all existing portlets and add yours (how to add).
Here is how it looks.