Optimal Liferay Core Development with Eclipse

This page describes the steps to install and configure an optimal Liferay Core development environment based on Eclipse.

Before you start #

If you haven't already, configure Eclipse to work with Liferay, as described here: Eclipse

Download sources and javadoc automatically for portal lib jars #

Open Eclipse in the workspace that holds your regular "portal-master" project.

Menu: "Window, Show View, Other..."

Select: "Maven Repositories"

Navigate to: "Global Repositories", "central"

Right-click, "Update Index".

Import and open any Maven project. That's all!

From now on, whenever you navigate to a class that comes from a lib jar, Eclipse will download its source code and Javadoc from Maven Central and display it automatically - even though portal-master is not a Maven project!

As long as the jar is found at Maven Central, it will work. Try it with:


If you don't have a Maven project to import, just create an empty one. (Actually this is highly recommended, for reasons soon to be explained.)

Menu: "File, New, Project".

Select: "Maven Project".

Check the box: "Create a simple project (skip archetype selection)".

Button: "Next".

Group Id: com.liferay.portal

Artifact Id: portal-master-lib-sources

Button: "Finish".

As long as you have a Maven project in your workspace and open it at least once a session, Eclipse will download sources and Javadocs for any jar it finds, even from non-Maven projects.

However, ".classpath" will become modified as a side effect. You'll probably want to suppress it from your Git change lists:

Select ".classpath"

Right-click, "Team, Advanced, Assume Unchanged".

If you're conscious about compiler warnings, you'll want to get rid of the message: "Build path specifies execution environment J2SE-1.5"

Add to pom.xml:


Select the Maven project.

Right-click, "Maven, Update Project..."

Button: "Ok".

Creating your own "portal-master-lib-sources" Maven project to be a companion for portal-master has another advantage: it lets you override portal-master's lib jar files with your own alternatives. This is specially useful when source download fails because the jar in lib has been manually modified and therefore is not found in Maven Central. An example:


This class will fail source download because portal-master's freemarker.jar is a modified version. But if you know what you're doing, you can override it with its Maven Central counterpart.

Add to pom.xml:


Select the "portal-master" project.

Right-click, "Build Path, Configure Build Path"

Tab: "Projects"

Button: "Add..."

Select your Maven project: "portal-master-lib-sources"

Tab: "Order and Export"

At the bottom of the list, select your Maven project: "portal-master-lib-sources"

Button: "Top"

Button: "OK".

Close the "portal-master" project, open it again.

Navigate to "freemaker.template.Configuration" and verify it's the one from the Maven project's "freemarker-2.3.20.jar", complete with source code.

Make sure you know what you're doing when working in this mode. Anything you launch from Eclipse that runs on the project classpath - unit tests, for example - will use the whole jar from Maven Central instead of the one from lib.

Use the JIRA issue tracker from Eclipse #

Liferay uses JIRA as an issue tracker. Install the Atlassian Connector to work with JIRA without leaving Eclipse:

JIRA Integration with Eclipse

See also #

Optimal Liferay Core Development

0 Anhänge
23512 Angesehen
Durchschnitt (0 Stimmen)
Die durchschnittliche Bewertung ist 0.0 von max. 5 Sternen.