Liferay-Development for beginners – Part two – Creation of a development environment

Categories: Java, Liferay

The development for the Liferay portal is quite nice by using a local develop environment with Eclipse, Mysql and Liferay. Therefore you should download the following components:

  • Liferay (http://sourceforge.net/projects/lportal/files/Liferay%20Portal/)
    • Liferay Portal bundled with Tomcat
    • Liferay Portal sources
    • Liferay Portal Documentation
    • Liferay Portal SDK
  • Eclipse
  • Eclipse Liferay IDE (downloadable via Eclipse Marketplace -> just search for Liferay in Marketplace)
  • MySql Community DB (aka MariaDB)

The basic installation and configuration of Liferay is described in part one of this series of articles. A good idea is to create a dedicated folder for your new project and place your Liferay installation inside in a separate folder.

Next we have the Liferay SDK, the Liferay sources and the Liferray documentation that are to be extracted also in separate folders of your project directory. So we have the following directory structure:

projectdir
| liferay
| sdk
| src
| doc

The folders for sources and documentation are project independent and can also be located on an different location. The Liferay and the SDK should be in your project directory, because they will be modified for and during your development process so that a reuse for other projects is not a really clever idea.

Before entering the fascinating world of Liferay development we have do configure the Eclipse IDE. After installation of the Eclipse Liferay plugin and restart of the IDE you have first to configure the Liferayintegration.

SDK Configuration

For configuration the SDK go to

Window > Preferences > Liferay > Installed Plugin SDK

Here we configure the existing SDK in our project directory.

Click on Add Add, browse to the SDK folder, click on OK. The suggested name is mostly ok, feel free to adjust the name it has no functional impact. Check „Add Eclipse .project …“ and „Open in Eclipse“. Finish this step by clicking on OK. If everything was ok the list shows now a SDK entry with your Liferay Version. If not an incorrect path is often the cause.

Liferay runtime configuration

Now the Liferay runtime configuration has to be done. Go to

Window > Preferences > Liferay

And click on „Create new Liferay runtime environment“. Choose the entry of your Liferay version and click OK. Now you have to point to the Liferay server directory, click on Browse and choose the root directory of your Liferay server directory (that contains a tomcat directory etc.). Click OK and then on Next to configure the location of your Liferay documentation Javadoc folder, the sources and the Liferay-Tomcat-Bundle-Zip. Finish by clicking OK.

Server configuration

The last step is to create a server. Click on „Create a new Liferay server“. Choose your Liferay version and click Finish. Now click on OK. We’re finished with configuration.

Cleanup Liferay

Before you start your new server go inside of your Liferay-server directory to

tomcat-<version-of-your-package>/webapps

delete the folders that start with sevencogs

then go inside of your Liferay-server directory to

data

and delete the hsql directory.

Next is to start the configured Liferay server on the server-tab of Eclipse.

Now you’re ready for your first Liferay project…

«
»

    Leave a Reply

    Your email address will not be published. Required fields are marked *