« Back to Liferay IDE

Liferay IDE Sharing Projects

Requirements #

The Project Sharing Problem #

Creating new plug-in projects with Liferay IDE is straight-forward (see Liferay IDE Getting Started Tutorial). However, it isn't quite as easy to figure out how to share these projects with other developers through a SCM system like SVN or CVS. The guide on this page gives a couple of ways that help making sharing possible, although the solutions are not optimal and hopefully can be improved in the future. (Comments or ideas are welcome)

How-to Share a Liferay IDE Project #

There are a couple of different methods for effectively sharing plug-in projects. One is simpler but requires more upfront configuration for other developers that are adopting the project (method #1). The other method is more work to create and may be more confusing to setup but will be easier for downstream developers to begin working with those projects (method #2).

Along with the step-by-step guides below there are also a couple of Youtube videos that show a demonstration of both of these methods:

Method #1: Direct Project Sharing #

Using this method the developer will directly commit the project sources to the repository and other developers when they checkout the shared project they must take special care to place the projects in the correct location of an existing plug-ins SDK folder structure. Below is the recommended steps for sharing a project in this scenario:

  • Steps by Deverloper-A
    1. Install Liferay IDE, Configure a plug-ins SDK by going to Liferay > Installed SDKs pref page
    2. Then creates one of the plug-in project types, e.g. projectA-portlet (See Getting Started Tutorial)
    3. Then commit this project to a SCM repository directly using the Team project menu in Eclipse, so project is at <SCM_ROOT>/projectA-portlet
    4. Send the name of the plugins-sdk (as configured in the preferences, shared-plugins-sdk in our example) to second developer-B
  • Steps by Developer-B
    1. Install Liferay IDE, then configure a plug-ins SDK using Liferay > Installed SDKs pref page.
    2. The configured plugins SDK can be located anywhere on the disk, but it must have the exact same name as used and sent by Developer-A
    3. Browses to the SCM_ROOT using repository browser once projectA-portlet is found, right-click and choose an option called "Check out as". Note for Subclipse, and Subversive, and CVS team providers in Eclipse this option is called "Check out as", for other Team providers this option may be different
    4. On the next page of the "check out as" (or maybe 3rd) there is an option for choosing the location of the project to checkout the sources to. By default it will be to go into the root of the eclipse workspace however, but I different location will need to be specified.
    5. Uncheck the default location and then browse to the directory of the configured plug-ins SDK and select the sub-directory of the plug-in type In this example it would be <plugins_sdk_dir>/portlets/ as the location to checkout the project, for hook plugins the hooks/ subdir would be used, etc.
    6. Select Finish to complete the project checkout.
    7. See the Resolving Errors After Import section for any problems that may occur after import

Method #2: Plug-ins SDK Sharing #

Using this method the one developer will create a new general project that will contain all of the files inside a normal distribution of the plug-ins SDK. New plug-in projects are created using this plug-ins SDK that is residing inside of the workspace and so those plug-in projects will automatically also be configured under the plug-ins SDK already in the workspace. So even though the individual plug-in projects are shown in the Project Explorer in Eclipse at a top level, they actually located inside the plugins-sdk project. Then the original developer will share the entire plugins-sdk project structure thus avoiding the necessarly config steps by other developers that want to develop the same projects. Here is the step-by-step guide:

  • Steps by Developer-A
    1. Install Liferay IDE, Creates a new general project called "shared-plugins-sdk" or whatever name is appropriate
    2. Then unzip contents of a Liferay plug-ins SDK into the new eclipse project
    3. Then go to Liferay > Installed SDKs pref page and add this new plugins SDK by browsing to the physical project folder
    4. Then create a new portlet project (or any other plugin type) called projectB-portlet Note the newly created project, even though its at the top level of the workspace in the Project Explorer, it will be physically located at <workspace_dir>/shared-plugins-sdk/portlets/projectB-portlet
    5. Right-click the shared-plugins-sdk folder and commit this entire project to source control
    6. Notice that it now is also shared since the contents of that project have already been committed and will not need to be separately checked in.
  • Steps by Developer-B
    1. Install Liferay IDE, browse to the SCM repository and find the entire plugins-sdk folder that was checked in as a general project in Source Control
    2. Right-click the shared-plugins-sdk project and checkout.
    3. Use the File > Import > General > Existing Projects into Workspace
    4. Choose the Select root directory option and browser to the physical location of any of the portlets parent directory that contains the projectB-portlet project folder in the workspace Any projects that had been created and checked in under the plugins-sdk should show up in the list of projects to import
    5. Select Finish to import the projects and now they will be avilable as normal projects under the Project Explorer
    6. See the Resolving Errors After Import section for any problems that may occur after import

Resolving Errors After Import #

After the checkout if there are project errors, it may be the SDK names are not identical in the to workspaces, or the project has a hard-coded JRE name instead of using a workspace default. These can be fixed manually or with the Java Build Path property page.

Future Sharing Support #

Method's #1 and #2 currently should work but neither solutions are optimal. In the future, Liferay IDE will try to optimize the sharing workflow to make it easier to accomplish without a rigorous procedure.

All comments, thoughts, and other feedback is welcome.

13 Attachments
24983 Views
Average (4 Votes)
The average rating is 3.5 stars out of 5.
Comments
Threaded Replies Author Date
looks interesting SZ khan September 30, 2010 2:51 AM
Although #2 seems a better option i have my... Corné Aussems February 3, 2011 3:28 AM
wondering if git would be a better option ? Jack Bakker July 11, 2011 11:03 AM
Maybe this article shows how to keep track of... Jan Roman December 3, 2013 2:45 AM
Maybe this article shows how to keep track of... Jan Roman December 3, 2013 2:45 AM

looks interesting
Posted on 9/30/10 2:51 AM.
Although #2 seems a better option i have my doubts when upgrading the SDK. But then again when upgraded it easier to propagate downstream?
Posted on 2/3/11 3:28 AM.
wondering if git would be a better option ?
Posted on 7/11/11 11:03 AM.
Maybe this article shows how to keep track of project changes but certainly not how to share projects.
What about .project and .classpath files as well as .settings? Unfortunatelly Liferay IDE is not clever enough to take care of such basic settings so checked in projects are unusable by other developers which are using separate machines.
Posted on 12/3/13 2:45 AM.
Maybe this article shows how to keep track of project changes but certainly not how to share projects.
What about .project and .classpath files as well as .settings? Unfortunatelly Liferay IDE is not clever enough to take care of such basic settings so checked in projects are unusable by other developers which are using separate machines.
Posted on 12/3/13 2:45 AM.