Importing Existing Projects into Liferay IDE
If you have been following the examples of this guide using the Plugins SDK or have previous plugins developed with it that you want to keep developing with Liferay IDE then this section is for you. It also shows other options to import. Specifically it shows how to import from:
Existing Liferay projects that are not in Eclipse workspace
Projects already in Eclipse but not Liferay IDE (don't have Liferay facet or target runtime)
Existing Liferay IDE projects from another version of Liferay IDE or workspace
The following subsections describe the steps for each of them with more detail.
Importing existing Liferay Project from a Plugins SDK
An existing Liferay project that has been created by the Plugins SDK but has not yet been added to an Eclipse workspace or have not been added to the current workspace open in Eclipse/Liferay IDE. These projects may or may not have .project or .classpath files. Whether they do or don't we will follow the same steps and use the same wizard.
There are two options to create projects from existing sources, depending on whether you want to create one single project or multiple projects from the same SDK. Let's see both in detail.
Note: The two next sections assume that you have Liferay plug-ins SDK directory structure and you have previously created projects inside of that directory structure
Create one single project from one plugin in an existing sources
This option will create one project for a single plugin that already exists inside a Plugins SDK.
In Eclipse, go to File > New > Project... > Liferay > Liferay Project from Existing Source
Or you can invoke the same wizard from the Liferay shortcut bar
Browse to the location of the project folder. Note: the project folder should be a sub-directory of one of the plugin types, e.g. portlets, hooks, themes, etc. If not it will not be able to be imported correctly. Once you select the plugin project folder you should see the plugin type and SDK version values get updated to correct values. If the SDK is not recent enough or project type is not correct it will be marked with an error.
Once you select the plugin project folder you should see the plugin type and SDK version values get updated to correct values. If the SDK is not recent enough or project type is not correct it will be marked with error
Next you will need to select a Liferay Runtime to configure on the project once it is imported. If you don't have a Liferay Runtime, use the New... button to create a new Liferay portal runtime (tomcat bundle only supported).
Click Finish to perform the import
Create multiple projects for all plugins in a Plugins SDK
This option will transverse an existing Plugins SDK and will allow creating one project for each of the plugins it finds inside in one single step.
In Eclipse go to File > Import... > Liferay > Liferay Plugin SDK projects
First you must select the Plugins SDK that you want to import projects from in the combo box at the top of the wizard.
If you don't have any SDKs configured in Liferay IDE use the "configure" link to add a setting that points to the Plugins SDK that you want to import projects from.
To configure a Plugins SDK on the Installed SDKs on the pref page just click "Add" and then Browse to the directory of the Plugins SDK root directory.
Once you have a configured Plugins SDK, you can select it in the Combo box and then the SDK location and version will be filled in. If either are not valid it will be marked with an error.
Importing an existing Eclipse Project that is not aware of the Liferay IDE
If your project is not in your Eclipse workspace, you can use the first set of steps above. If your project is already in your workspace (see it in project explorer) but is not yet a Liferay IDE project, the following steps can be used to convert the project.
In Eclipse, right click the eclipse project that you want to convert, select Liferay > Convert to Liferay plug-in project.
Note: If you don't have a convert action available it means the project is either already a Liferay IDE project or it is not a faceted project with Java and Dynamic Web project facets configured and will need to be configured accordingly
Select the Liferay runtime that you wish to set on the project. If you don't have a Liferay Runtime define use the "New..." action to create one.
Read the section below on verifying the success of an import process to make sure that your project was configured correctly as a Liferay IDE project.
Importing an existing Liferay IDE project
This section describes the steps that can be followed if you have previously created or converted a Liferay IDE project in your workspace but it is no longer in the current workspace there are a couple of options for importing this project.
Open Liferay IDE, go to File > Import ... > General > Existing Projects into Workspace
Use option Select root directory, then click Browse
Select the directory of the previous Liferay IDE project
If you have any errors, it may be that either the SDK name used in that project or the runtime id used doesn't exist in your new workspace. You can modify the SDK name in the Project Properties > Liferay page and you can modify the targeted runtime in the Project properties > Targeted Runtimes page.
Verifying that the import has succeeded
Follow the following steps to verify that either of the previous import processes has been successful.
Once the project import process is finished, you should see a new project inside Eclipse and it should have a "L" overlay image to show its a Liferay project.
Secondly, to make sure the project is now a "Liferay IDE" project is to check the target runtime project property (right-click project > properties > target runtimes) and also check the project facets to make sure both Liferay runtime and Liferay plug-in facets are properly configured.