Over a million developers have joined DZone.

Exporting and Importing Projects in Eclipse

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

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!

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!


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

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}