Skip to main content
Anguel
Associate III
June 2, 2021
Solved

Best way to duplicate a workspace with projects

  • June 2, 2021
  • 9 replies
  • 5875 views

Hi,

Let's say I have a workspace with multiple projects (e.g. application project, bootloader project, etc.) for a product. Let's say this workspace is located in C:\ProductA. Now I would like to duplicate this workspace to use it for another product let's say ProductB, it will be located in C:\ProductB, but of course I want to also keep ProductA. After Googling a lot about doing this in Eclipse I now have found two ways to achieve this:

Option 1: Create a completely new workspace C:\ProductB from scratch and then import the projects from C:\ProductA into that workspace by ticking the "Copy projects into workspace" option. The problem with this approach is that all workspace settings will need to be imported in a separate step from the old workspace and I am not 100% sure that CubeIDE will actually copy all additional files and folders from the old folder.

Option 2: Do a filesystem copy of C:\ProductA to C:\ProductB and open C:\ProductB in STM32CubeIDE. The annoying problem here is, that all project links still point to the old C:\ProductA folder as Eclipse uses absolute paths! So a proposed quick solution is to simply remove the projects from that workspace (without deleting them from disk) and then reimport them (without having to copy them into the new workspace, as they are already there). After doing so all project links seem to point to C:\ProductB and all workspace settings seem to be still there.

Somehow I like the second approach better, as I do a manual full copy of all files contained in C:\ProductA to C:\ProductB, also if there are some additional files or folders they will be also copied over and I don't have to export/import workspace settings. What do the gurus think about this? Are there some possible drawbacks of the second approach I did possibly overlook?

Thanks in advance and best regards,

Anguel

This topic has been closed for replies.
Best answer by Cartu38 OpenDev

I fear no good solution (or at least no click button one) because already Eclipse is not so smart here (especially thinking linked resources). On top of STM32Cube is adding its own complexity definitively preventing to get any obvious solution.

Such said all is possible taking care.

Good is already you're not thinking to get a very different file location if your workspace. Moving from <path>/ProductA to <path>/ProductB is helping already. If you were thinking to revisit <path> depth would be I guess almost impossible (because linked resources).

From my point of view best is really a copy of original workspace (file system copy). Then looks for "ProductA" to "ProductB" replacement scanning all files within the new workspace. All files means all ... not only sources but tools metadata too. Thanks such forum exchanges we know already some .mxproject file if some is sensitive metadata.

Doing such sounds to me you may get some success.

PS: just in case do an archive (.zip or ...) of your orignal workspace. If failing within some metadat hacks we have seen thru such forum comments at a point some magic may despite working on your new workspace corrupt your original one (back to .mxproject stuff ...)

9 replies

Cartu38 OpenDev
Cartu38 OpenDevBest answer
Graduate II
June 2, 2021

I fear no good solution (or at least no click button one) because already Eclipse is not so smart here (especially thinking linked resources). On top of STM32Cube is adding its own complexity definitively preventing to get any obvious solution.

Such said all is possible taking care.

Good is already you're not thinking to get a very different file location if your workspace. Moving from <path>/ProductA to <path>/ProductB is helping already. If you were thinking to revisit <path> depth would be I guess almost impossible (because linked resources).

From my point of view best is really a copy of original workspace (file system copy). Then looks for "ProductA" to "ProductB" replacement scanning all files within the new workspace. All files means all ... not only sources but tools metadata too. Thanks such forum exchanges we know already some .mxproject file if some is sensitive metadata.

Doing such sounds to me you may get some success.

PS: just in case do an archive (.zip or ...) of your orignal workspace. If failing within some metadat hacks we have seen thru such forum comments at a point some magic may despite working on your new workspace corrupt your original one (back to .mxproject stuff ...)

Anguel
AnguelAuthor
Associate III
June 2, 2021

Thanks @Cartu38 OpenDev​ ,

Now I cleaned and rebuilt the projects (both debug and release) then scanned for references to the original project's path.

Here is a list of the files still containing references to the old project folder:

0693W00000BZtCWQA1.png 

In .mxproject the only references are under [PreviousGenFiles], I think this should not be a problem.

To make sure, I also renamed the old project folder and what is strange is that it was then recreated with the following file:

"...\OLD_PROJECT\STM32CubeIDE\.metadata\.ide.log"

with the following contents:

2021-06-02 12:54:38,902 [INFO] Activator:170 - 
 
2021-06-02 12:54:38,907 [INFO] Activator:171 - !SESSION log4j initialized
 
2021-06-02 12:54:40,454 [ERROR] LogOutputStream:74 - [STDERR_REDIRECT] Managed Build system manifest file error: Could not load icon "icons/chip.png".
 
2021-06-02 12:54:40,460 [ERROR] LogOutputStream:74 - [STDERR_REDIRECT] Managed Build system manifest file error: Could not load icon "icons/chip.png".
 
2021-06-02 12:54:40,470 [ERROR] LogOutputStream:74 - [STDERR_REDIRECT] Managed Build system manifest file error: Could not load icon "icons/chip.png".

Anguel
AnguelAuthor
Associate III
June 2, 2021

A short update:

Now I did a manual search and replace in config files only, no binary files, no log files, no .lnk files, etc.

If your old path has a slash in the directory path that has to be removed beware that the slash can be written as \, /, \\, //, \/, etc. in the config files - this is an additional problem.

For search and replace I found "InfoRapid Search & Replace" to be very useful.

These are the files in which I did a manual path replace: .mxproject, .log4j.xml, *.launch, dialog_settings.xml, *.prefs, *.json

This is so annoying and such a waste of time. I don't know how so many IDEs can be based on Eclipse and how this multi-platform IDE does not support relative paths.

Piranha
Principal III
June 5, 2021

Just follow my advice here:

https://community.st.com/s/question/0D53W00000hOmC4SAK/cannot-update-stm32cubeide-from-160-to-161-on-windows

Needless to say that EmBitz uses relative paths and moving/duplicating a project takes... just imagine it - a Cut/Copy and Paste operations on a project folder in a file system. What a magic!

Cartu38 OpenDev
Graduate II
June 5, 2021

@Piranha​ unfair & useless comment ...

Cannot compare apples and pears ...

Piranha
Principal III
June 6, 2021

Having to do wild dances just for managing files and folders... Seriously? That is just terribly unproductive. The whole Eclipse's "Workspace" concept is broken by design. Even the Eclipse developers seem to start admitting it...

https://wiki.eclipse.org/Workspace4.0#Decouple_Workspace_from_Client.2FUI