When importing project, should "Copy Projects into Workspace" be checked ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

When importing project, should "Copy Projects into Workspace" be checked ?

3,198 Views
anaseem
Contributor IV

From the main menu, I select File - Import..  Select General / Existing Projects into Workspace and click Next.

Then, I select the directory that contains the project I need to import into MCUXpresso.

There is an option to check "Copy Projects into workspace".  Should this option be checked or NOT checked?

0 Kudos
9 Replies

2,892 Views
billherring
Contributor I

I also have puzzled over this question and unfortunately the replies haven't helped me understand whether to check or not check.

 

I am about to upgrade from v10.3 to v11.1 and the advise seems to be to use a new workspace, import the projects from your old/existing workspace and delete IDE generated files such as launch and build files. In this situation should I check or not?

 

To me importing and copying mean the same thing. However I can understand that maybe importing might omit certain artifacts so that they can be freshly (and maybe differently) generated in the new workspace. So to check 'Copy projects' would suggest to me that everything is going to be copied 'as is'. But why do this - if you do then surely you may as well just use your original workspace with your new xpresso (I understand you may then not be able to use it with your old xpresso version).

 

Bill Herring

0 Kudos

2,892 Views
ErichStyger
Senior Contributor V

Hi Bill,

'workspace' and 'project' are two different concepts:

  • the workspace is where you store your 'working' settings and to organize your projects. The workspace use a kind of data base which gets into the .metadata folder inside that workspace folder. You can store projects in the workspace directory too (this is in many cases the default), but my recommendation is to have the projects stored outside the workspace folder and instead link to them. There are many reason for this, including to keep things independent of Eclipse or organizing the projects in the way you want, or simply to make it easier to work with version control systems.
  • the project is a folder which contains a .project file plus other project related files, including typically the source files and so on. The project is a kind of container to organize and store things

You can add, import and export projects with a workspace. If you import one or more projects, you can choose to link to it (your workspace simply will contain a link to the target project) or you can copy it (it will physically copy the project folder into your workspace folder). The important thing with the copy is that it is simply a copy of that project folder with all its files and subdirectories. But it is not a 'deep' copy in the sense that it will copy all the depending projects or relations. So if that target project uses files from a parent project or from folders relative to that project, a copy of the project will fail, because the links will be broken. If you just link to that importing project, the links remain intact. Moreover if you link to that project from different workspaces, you don't end up with copies (unless you want copies).

As to the advice to use a new workspace for every new eclipse version: the reason is that Eclipse is able to upgrade its metadata to a newer Eclipse version (it is upwards compatible), the opposite is not true: if you use a workspace with a newer Eclipse and then later use that workspace with a previous versions, things likely might be broken: that's the recommenation to use dedicated workspaces for each Eclipse but link to the projects. There still might be a problem if the project settings go through dramatic changes between versions (especially build tool settings and the like), in that case you better keep the projects tight to a version of your Eclipse.

I hope this helps,

Erich

0 Kudos

2,892 Views
billherring
Contributor I

Hi Erich,

Thank you for enlightening me. I think I now understand much better.

My current 'workspace' contains my source since, in the beginning, it seemed natural to me to match a 'workspace' to the root of my version controlled source 'project' (that's what a 'workspace' used to mean - right?). The xpresso 'projects' were then also placed in there by default.

From what you say I'm minded to create a new 'workspace' for my upgrade inside my existing 'workspace' directory, i.e. inside what I consider to be my version controlled project, so that the original xpresso projects are still outside. Then I can have what you recommend, i.e. a workspace linked to projects outside of it. I can then continue this approach for future Xpresso upgrades, i.e. leading to perhaps multiple workspaces inside my version controlled project.

Bill

0 Kudos

2,892 Views
ErichStyger
Senior Contributor V

Hi Bill,

one reason not to have the workspace folder on the root of the version control repository is that for sure you don't want the .metadata folder in the VCS (never share the .metadata).

You can have linked projects to anywhere. But what you should not do is to nest Eclipse workspaces: do not put a new workspace inside an existing workspace.

Erich

0 Kudos

2,892 Views
billherring
Contributor I

Hi Erich,

I've probably mislead you regarding my version control by trying to be too brief with its description. Yes I have my 'workspace' pointing to the root of my source project which is mostly under VCS, but not all of it. Many things are excluded for not being relevant and this includes a lot of things from xpresso such as those you mention.

Regarding workspaces within workspaces .  .  . ok I will heed your warning although it would have been convenient to keep everything together in one VCS area. The project files (cproject and project) are the few items from xpresso that I keep under VCS since they define build and debugging and its essential this persists.

So now I'm scratching my head again regarding what you exactly mean by project linking? If I abandon my current workspace, check out a new VCS area, create a new xpresso workspace within it and import xpresso projects from my old workspace - what will I get regarding project files and what will be their relationship to the original files in the old workspace? Are they 'linked' if so how? If I modify in my new workspace will I have project files independent of the originals? If not how do I do so?

Sorry for ongoing questions.

Bill

0 Kudos

2,892 Views
ErichStyger
Senior Contributor V

Hi Bill,

workspace and VCS: ok, understood.

workspaces inside workspaces: I do not recommend to add/create a workspace inside an existing workspace folder: this can confuse Eclipse and lead to strange things, at least with Eclipse versions in the past.

Project linking: at import time, you get the choice of either 'copy' or to 'link'. If you copy, and if your project has links (see Link to Files and Folders in Eclipse | MCU on Eclipse ) to other projects, these links remain unchanged. In most cases these links are project-relative (relative to the project location on disk), so if you copy them with the import these links will be broken. It would work if you would have absolute links, but that's again something to avoid.

I hope this helps,

Erich

0 Kudos

2,892 Views
BlackNight
NXP Employee
NXP Employee

It really depends on the kind of project. As said, if in doubt, copy the project.

With 'copy' the project gets copied, but not the linked parts. So if you have a project which references/links to other projects and if these links are say project relative, the copied project might not build.

If you copy the project, the original project remains 'as is' and you work on a copy of it. If you want to work and change the original project, then do not copy it.

I hope that makes sense,

Erich

0 Kudos

2,892 Views
lpcxpresso_supp
NXP Employee
NXP Employee

Generally, yes. And if in doubt, then definitely yes. However, I would actually recommend that you use the QuickStart Panel's "Import project(s) from filesystem..." option. For more general information, please see chapter 10, "Importing Example Projects (from the file system)" in the MCUXpresso IDE v10.3 User Guide.

Regards,

MCUXpresso IDE Support

0 Kudos

2,892 Views
anaseem
Contributor IV

OK.  In future, I'll follow your advise but I had imported project as described in my question above.  I did not select the option to copy project into workspace.  Will I able to change files in the project and build?

0 Kudos