1.6. Project cloning


1. Duplicating an existing Eclipse project

 
The procedure described next is probably not the simplest way to duplicate a project, but it is safe. Although you can copy/paste a project directly from the Project Explorer within Eclipse, some paths are not well updated and you may mess up existing projects.
 

1.1. Copy the source project folder

Let us now create a copy of the ‘nucleo64_F072RB_template’ project under the name ‘my_project

Using Windows, navigate into your workspace folder ‘tuto_workspace’ and copy/paste the ‘nucleo64_F072RB_template’ folder:

image024.png

 
Then, rename the new folder with the new project name you want:

image025.png

 
Put that name into the clipboard for what’s coming:

image027.png

 

1.2. Clean/Update new project folder

 
Now open the my_project folder:
Delete the Debug folder (these have been produced during build).

image030.png

 

Now, open both .project and .cproject files into a text editor (preferably notepad++). Replace every occurrence of ‘nucleo64_F072RB_template’ by ‘my_project’. It’s better to use an automatic find/replace utility if available:

image032.png

 

  • In the .project file, there is usually only one occurrence within the <name> tag:
image034.png
 
  • In the .cproject file, there are several occurrences. In this example, 3 replacements were performed, but you may have more…
image036.png
image037.png
image038.png

 

Save and close both .project and .cproject files. The my_project folder is now as below:

image039.png

 

2. Import the new project into the Atollic® workspace

 

Launch Eclipse if not yet.
Go to File → Import

image041.png
 

Choose Existing Project into Workspace and click Next

image043.png

In the next dialog:

  • Put your workspace path as the Select root directory
  • Tick the project you want to import
  • Clear other options (we don’t need to copy project, it is already there)

 

image045.png

Then click Finish.

The new project my_project is now displayed in the Eclipse Project Explorer:

image047.png

 

You should be able to build it image010.png without problem since all the build options you have set in the source project have been preserved during the cloning operation:

image048.png

 

3. Run/Debug configuration

 
The Debug/Run configurations are not copied, therefore you need to do it again for the cloned project:

  • Open Debug Configurations
  • Create a new configuration under Embedded C/C++ Application category:
image050.png

 

  • Check that Main tab is all right:
image051.png
 
  • Open Debugger tab and set the correct Debug probe:
image053.png

 
That’s basically all you have to do. You can close the debug configuration windows and start working with the new project.

 

4. Summary

In this tutorial, you have learned a way to make clean duplicate of existing projects within Eclipse in order to start a new project using a previous one as a starting point.
The project my_project will be used all along the next labs.