Importing Projects from Eclipse

If you wish to work alongside Eclipse or MyEclipse, NetBeans lets you use the Project Import functionality.

This functionality will import one or more projects created by the Eclipse IDE simply by specifying the workspace in which they are housed.

Getting ready

A valid Eclipse project, with sources and dependencies, must be used in order to continue with this recipe.

How to do it...

  1. Click on File and then on Import Project and Eclipse Project....
  2. In the Import Eclipse Project window, select Import Eclipse Project.
  3. Click on the Browse... button. An Open dialog will pop-up for workspace selection.
  4. After selecting a valid workspace project, click the Next > button.
  5. In the Projects to Import section, select the projects you want to import.
  6. Select Store NetBeans project data inside Eclipse project folders.
  7. Click the Finish button.

How it works...

By selecting the workspace directory, NetBeans will then analyze and convert the metadata created by Eclipse.

The project structure, along with the dependencies, will be available for NetBeans usage. It is important to notice that NetBeans will not change the way the Eclipse project behaves.

On Store NetBeans project data inside Eclipse project folders, NetBeans will create its own structure inside the Eclipse folder structure. Select this option if you want to distribute the NetBeans project directory in a Version Control System. This ensures that libraries and configuration files used by Eclipse and NetBeans are the same.

How it works...

It is also possible to use NetBeans without placing its configuration files inside Eclipse's workspace. If this is the desired outcome, then select Create imported NetBeans projects in a separate location and then click on Browse... to select the folder where NetBeans configurations will exist.

The imported Eclipse projects will then be placed on the Projects tab on the right-hand side.

In the There's moreā€¦ section, there is a list of some errors that might arise when importing an Eclipse project.

There's more...

Now let's talk about some other options, as well as some pieces of general information that are relevant to this task.

Synchronizing Eclipse

With multiple developers working on a project, it is common that changes to a project happen from time to time. When this happens, NetBeans can resynchronize the projects by the following:

  • File
  • Import Eclipse Project
  • Resynchronize Eclipse Projects

After following these steps, the classpaths of all the projects imported to Eclipse will be in sync. Changes to your local project will not be synchronized back, however. This way, NetBeans ensures that the local configurations will not damage the parent project.

More error dialogs

While importing Eclipse projects, some importing errors might come up.

Many of these errors are not specific to our recipe but the following notes might come in handy while developing future projects.

Some of these errors are:

  • Resolve Missing Server Problem: Just right-click on the project node and browse to the folder where the server is installed.
  • Resolve Reference Problem: Occurs when libraries are missing from the project class path. Solving this is very similar to the missing server problem. Right-click on the project node and select Resolve Reference Problem, and then select the folder where the library is.
  • Eclipse platform for Project Name cannot be used. It is a JRE and the NetBeans project requires a JDK. NetBeans will use the default platform: This is due to the Eclipse project being configured with a JRE instead of JDK. To solve this, click on the toolbar in Tools, and then select Java Platforms. The Java Platform Manager will be shown, click on Add Platform... and from the options, select the correct Java Platform the application is being developed on.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.120.6