What if you have existing projects that you want to work on in Liferay IDE? You can import your existing projects into Liferay IDE to take advantage of Liferay IDE’s developer tools.
We’ll cover the following import scenarios:
Importing existing Liferay projects from the Plugins SDK.
Importing Eclipse projects that aren’t in Liferay IDE (i.e., don’t have the Liferay facet or target runtime).
Importing existing Liferay IDE projects from another Liferay IDE version or workspace.
Let’s start by learning how to import existing Liferay projects from Liferay Plugins SDK.
You can import Liferay projects you created with the Plugins SDK, but aren’t yet in your Liferay IDE Eclipse workspace. These projects might already have
.classpath files in them; regardless, we’ll use the same procedure to import them.
First let’s look at the import process for creating a single Liferay IDE project from a Plugins SDK project. Follow these steps:
In Liferay IDE, go to File → New → Project… → Liferay → Liferay Project from Existing Source.
You can invoke the same wizard from the Liferay shortcut bar; just click the Create a New Liferay Project button.
Browse to your project folder. It should be a subdirectory of one of the plugin types (e.g., portlets, hooks, themes, etc) or it won’t import correctly. Once you select the plugin project folder, its type and SDK version values are updated to the correct values. If the SDK isn’t recent enough or the project type is incorrect, it gets marked with an error.
After you select the plugin project folder, the Liferay plugin type and Liferay plugin SDK version values are updated. If your Plugins SDK is outdated or you entered an incorrect project type, its field gets marked with an error.
Select the Liferay target runtime to configure on the project once it’s imported. If you don’t have a Liferay Portal Runtime, use the New… button to create one now.
Click Finish to perform the import.
Remember to verify that your project was configured correctly as a Liferay IDE project. Verification is described right after our next topic, which is making multiple Liferay IDE projects from a single Plugins SDK.
Next we’ll show you how to import all your Plugins SDK projects into Liferay IDE.
Batch Importing Multiple Projects into Liferay IDE
Does your Plugins SDK contain multiple plugins? You can easily batch import each plugin in your Plugins SDK as its own Liferay IDE project.
In Eclipse go to File → Import… → Liferay → Liferay Projects from Plugins SDK.
In the Import Projects window, use the combo box to select the Liferay Plugins SDK you’re importing plugins from.
Once you select your Plugins SDK in the combo box, the Liferay Plugin SDK Location and Liferay Plugin SDK Version fields are automatically filled in, as long as they’re valid. Invalid entries are marked with an error.
The list of projects that are available for import are displayed in a table. Any projects already in the workspace are disabled. Projects available for import have an empty check box; select each project you’d like to import.
Select the Liferay runtime you want to set up for the imported projects.
If you don’t have a Liferay runtime, can add one now with the New… button.
Your plugins are imported! Next, we’ll talk about importing existing Eclipse projects into Liferay IDE.
Importing Existing Eclipse Projects into Liferay IDE
The steps we outlined above let you import projects that have never been opened in Eclipse. If you’ve been using Eclipse without Liferay IDE, you may already have a project in your Eclipse workspace. Follow the import steps below to convert your project.
In Eclipse, right-click the project in your Project Explorer, and select Liferay → Convert to Liferay plugin project.
In the Convert Project wizard, your project should be selected and the SDK location and SDK version should be detected automatically. If they aren’t valid, an error message is displayed.
Select the Liferay runtime to use for the project. If you don’t have a Liferay Runtime defined, do so now by clicking New….
Remember to verify that your import was successful and that your project was configured correctly as a Liferay IDE project. We have one more import scenario to cover–importing existing Liferay IDE projects into your Liferay IDE.
Importing an existing Liferay IDE project
What if you had a Liferay IDE project in your workspace, but it’s not there anymore? Here’s how you can import it into your current workspace:
Open Liferay IDE, go to File → Import … → General → Existing Projects into Workspace.
Choose the option Select root directory, then click Browse….
Select the directory of the Liferay IDE project to import.
In the Projects: list you should see your Liferay IDE project.
Let’s verify the success of your imports and ensure that they’re properly configured as Liferay IDE projects.
Verifying that the import has succeeded
After importing projects into Liferay IDE, you’ll want to verify that they imported successfully, and that they’re properly configured as Liferay IDE projects. Here’s how you verify that your imports were successful:
Once the project is imported, you should see a new project inside Eclipse and it should have an “L” overlay image; the “L” is for Liferay!
Let’s check the project’s target runtime and facets to make sure it’s configured as a Liferay IDE project:
2.1. In the Package Explorer, right click
→ Properties → Targeted Runtimes.
2.2. In the Properties window, click Project Facets and make sure both Liferay runtime and Liferay plugin facets are properly configured.
Great! You’ve confirmed that your import was successful; you can now make revisions to your configured Liferay IDE project. Next, let’s explore Liferay IDE’s Remote Server Adapter feature.