I admit that I have (a few? or not so few) bad habits: one of them 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 lets 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: 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 Zip that projects into an archive file Delete from that archive file any derived resources (see dissection of mcu10 projects ), as well as remove all the version control information. Copy the archive file into the destination workspace and unzip it there 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. Select one or more project and use the ‘export’ context menu or file > export. Here select general > archive file: export project as archive file 2. In the ext dialog, you can deselect files and folder. additionally, you need to specify the archive file. You could use filter types (e.g. to include *.c and *.h). I really wish that this dialog would consider the ‘derived’ flags for files and folder, so I could deselect them easier. archive file settings 3. In the destination workspace, use the menu file > import : import dialog to import a project and here is the stumbling point: Do not (!) select ‘archive file’, but ‘ existing projects into workspace ‘. I have exported it as archive file, but importing an archive file is importing an archive file inside a project , not (!) as a project . This is a usability quirk in eclipse. 4. In the next dialog, you can choose the archive file and make adjustments which project you want to import. Note that it will automatically copy the projects into my workspace. import archive projects 5. Click finish, and the projects get imported. Summary 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!
May 10, 2022
by Erich Styger
·
141,692 Views
·
8 Likes