Exporting and Importing Projects in Eclipse

DZone 's Guide to

Exporting and Importing Projects in Eclipse

· Java Zone ·
Free Resource

I admit that I have (a few? or not so few) bad habits: one of it is that usually I find a way to do things, and if that works, I stick with it. I know that there are other ways to do things, but hey, why bother? And sometimes a good friend asks an excellent question (are there any bad questions?), and this let me review the way I’m doing things. And here is such a thing: exporting and importing projects in Eclipse.

Archive Files with Drag & Drop

Here is how I usually move or copy a project to another machine:

  1. Find the project place on my hard disk. An easy way is to select the project folder and use the context menu with Show in Windows Explorer
  2. Zip that project into an archive file
  3. Delete from that archive file any derived resources (see Dissection of MCU10 Projects), as well remove all the version control information.
  4. Copy the archive file into the destination workspace and unzip it there
  5. Then drag&drop that folder into Eclipse: this will import that project into the workspace. Instead of the folder I simply can drag&drop as well the .project file

Note: Best if I drag&drop the project into the ‘CodeWarrior Projects’ View. This will not work if I drop it into the Processor Expert ‘Project Panel’ view.

Well, that works, and I really get used to that process. So why bother? Because there is actually a better way: to Export and Import.

The Export and Import Way

  1. I select one or more project and use the ‘Export’ context menu or File > Export. Here I select General > Archive File:
    Export Project as Archive File

    Export Project as Archive File

  2. In the ext dialog I can deselect files and folder. Additionally I need to specify the archive file. I could use Filter Types(e.g. to include *.c and *.h), but really what I wish is that this dialog would consider the ‘derived’ flags for files and folder, so I could deselect them easier.
    Archive File Settings

    Archive File Settings

  3. In the destination workspace, I use the menu File > Import:
    Import Dialog to Import a Project

    Import Dialog to Import a Project

    And here is the stumbling point: I do not (!) select ‘Archive File’, but ‘Existing projects into Workspace‘. Yes, I have exported it as Archive File, but Importing an Archive File is importing an archive file inside a project, not (!) as a project. Yes, this is a usability quirk in Eclipse :-( .
  4. In the next dialog I can choose the archive file and make adjustments which project I want to import. I note that it will automatically copy the projects into my workspace.
    Import Archive Projects

    Import Archive Projects

  5. Pressing Finish, and my projects get imported.


I’m using combinations of both ways: the archive file produced by the Export is not different from an archive file I create with my WinZip archive utility (or any other tool like this one). For both export ways I need to manually remove what I do not want in the archive file. I wish there would be better support for this. But for importing projects the Import functionality is really good, as it avoids the copy/extract/drag&drop way: I can go through two dialogs, and that’s it.

Happy Export-Import :-)

PS: Thanks to Mark Ruthenbeck having me considering more the Export/Import way!

eclipse, ides

Published at DZone with permission of Erich Styger , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}