如何在Eclipse中更改项目的位置?

时间:2022-08-26 11:28:10

A project has moved to a different location, so Eclipse won't open the project. You'll immediately think about simply changing the pointer to the location, but in Eclipse they try to make this impossible for some reason.

项目已经迁移到不同的位置,因此Eclipse不会打开项目。您将立即考虑简单地更改指向位置的指针,但是在Eclipse中,由于某些原因,他们试图使这个不可能。

You cannot change the project location in the Project Explorer properties.

您不能在project Explorer属性中更改项目位置。

You can go to [workspace]/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/ProjectName and try to edit .location which is the pointer to the project, but this file is purposely stored in binary.

您可以访问[工作区]/eclipse/.metadata/.plugins/org.eclipse.core.resources/。项目/ProjectName并尝试编辑.location,它是指向项目的指针,但该文件是故意存储在二进制文件中。

How do I change this .location, is there a tool for that? Any other way to simply point my old project entry to it's new location?

我如何改变这个,位置,有工具吗?还有其他方法可以简单地指出我的旧项目条目到它的新位置吗?

7 个解决方案

#1


52  

Delete the project from eclipse.

从eclipse中删除项目。

ENSURE THAT THE CHECK BOX is UNSELECTED, during this delete

在此删除期间,确保复选框未被选中。

And then import the project by File -> Import -> Import existing project and choose it from the new location.

然后将项目导入文件->导入->导入现有项目并从新的位置进行选择。

Don't try to modify the eclipse files manually!

不要尝试手动修改eclipse文件!

#2


9  

Much more simple:

更简单:

Right click -> Refactor -> Move

右击->重构->移动。

.

#3


4  

You can go to [workspace]/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/ProjectName and try to edit .location which is the pointer to the project, but this file is purposely stored in binary. You Should Edit the location in file and some binary data ] the binary data that should edit , is bold :

您可以访问[工作区]/eclipse/.metadata/.plugins/org.eclipse.core.resources/。项目/ProjectName并尝试编辑.location,它是指向项目的指针,但该文件是故意存储在二进制文件中。您应该编辑文件的位置和一些二进制数据)应该编辑的二进制数据,是粗体的:

40 B1 8B 81 23 BC 00 14 1A 25 96 E7 A3 93 BE 1E 00 5D 55 52 49 2F 2F 66 69 6C 65 3A 2F 44 3A 2F 6D 61 64 64 61 68 2F 50 72 6F 6A 65 63 74 73 2F 46 6C 65 65 74 4D 61 6E 61 67 65 6D 65 6E 74 2F 54 79 70 65 73 2F 50 6F 72 74 61 62 6C 65 63 6F 64 65 2F 46 69 72 6D 77 61 72 65 2F 74 65 73 74 2F 43 50 50 2F 41 54 6D 65 61 67 38 4C 69 62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 58 FB F3 23 BC 00 14 1A 51 F3 8C 7B BB 77 C6

40 B1 8 b 81公元前23日00 96 96 25 E7 A3是1 e 00 5 d 55 52 49 2 f 2 66 69 6 c 69 3 2 f 44 3 2 6 d 61 64 64 61 61 2 f 72 6 6 65 63 74 73 2 f 46 6 c 65 65 74 4 d 65 6 e 61 67 65 6 d 65 6 e 65 2 f 54 79 70 65 73 72 74 61 62 50 6 f 6 c 65 65 6 64 65 2 f 46 69 72 6 d 72 61 72 65 2 43 50 50 74 65 73 74 2 f 2 f 41 54 6 d 4 c 65 61 67 65 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 58 FB F3公元前23 1 00 14 51 F3 8 c 7 b BB 77 C6

The Location of 0x11 of file, is the length of file name, that you should edit it. its value is the length of highlighted part

文件的0x11的位置,是文件名的长度,您应该编辑它。它的值是高亮部分的长度。

Also You Can Use ProjectLocationUpdater : https://marketplace.eclipse.org/content/projectlocationupdater/metrics

也可以使用ProjectLocationUpdater: https://marketplace.eclipse.org/content/projectlocationupdater/metrics。

#4


2  

I realise this is an old post however I thought I would add my own resolution to the same issue. I had imported a number of projects into my workspace from another machine. However the resource files would not build because for some reason Eclipse had marked the location of the projects incorrectly (using a mapped path instead of a unc path). This meant that each time I tried to reference libraries within the workspace they would tick green, then go red and fail. Despite the fact the libraries and the project where in the same workspace and I had followed the correct procedure for importing the projects.

我意识到这是一篇老文章,但我认为我应该把自己的解决方案添加到同样的问题上。我从另一台机器导入了一些项目到我的工作空间。但是,资源文件不会构建,因为某些原因Eclipse已经错误地标记了项目的位置(使用映射路径而不是unc路径)。这意味着每次我尝试在工作区中引用库时,它们都会标记绿色,然后红色和失败。尽管库和项目在同一个工作区中,我也遵循了导入项目的正确步骤。

As the OP mentions under properties there is a project location path. I noticed that the project location was different but for some bizarre reason Eclipse (in their almighty wisdom) do not allow you to reselect or change the path. In fact even trying the refactor->move fails because the project is already inside the workspace (never heard of generating a temp folder for moves?).

正如OP在属性中提到的,有一个项目位置路径。我注意到项目的位置是不同的,但是由于某种奇怪的原因Eclipse(在他们的万能智慧中)不允许您重新选择或更改路径。实际上,甚至尝试重构->移动失败,因为项目已经在工作区中(从未听说过生成一个用于移动的临时文件夹)。

However I did notice after looking at the file structure of the imported projects that Eclipse had added a .location file (mentioned above) which was actually absent from all other projects in the workspace. So I deleted the .location file, reopened eclipse and sure enough the projects build properly.

但是,在查看了Eclipse添加的导入项目的文件结构之后,我确实注意到了。location文件(上面提到过)实际上不在工作区中所有其他项目中。因此,我删除了.location文件,重新打开eclipse,并确保项目正确地构建。

So after wasting a few hours on something as silly as this I am now able to work and hopefully this might save you some trouble too.

所以,在浪费了几个小时之后,我现在能够工作了,希望这能给你省点麻烦。

#5


0  

You can change the .location file using a hex editor. However, you cannot simply replace the file location string stored there by the new one. You also have to edit the preceding byte defining its length (in bytes) accordingly. You may then re-open the project in Eclipse.

您可以使用十六进制编辑器更改.location文件。但是,不能简单地替换存储在新文件中的文件位置字符串。您还必须编辑前面的字节,并相应地定义其长度(以字节为单位)。然后,您可以在Eclipse中重新打开项目。

#6


0  

It is not advisable to change the .location file. The eclipse project list will be destroyed if you manually edit the .location file. I lost all the projects after modifying the file.

更改.location文件是不可取的。如果您手动编辑.location文件,eclipse项目列表将被销毁。修改文件后,我失去了所有的项目。

#7


-2  

Try this. Open eclipse --> Go to File --> switch workspace --> other --> choose your workspace by clicking the Browse button. Hope this will work.

试试这个。打开eclipse——>转到文件——>开关工作区——>其他——>通过点击Browse按钮选择您的工作空间。希望这将工作。

#1


52  

Delete the project from eclipse.

从eclipse中删除项目。

ENSURE THAT THE CHECK BOX is UNSELECTED, during this delete

在此删除期间,确保复选框未被选中。

And then import the project by File -> Import -> Import existing project and choose it from the new location.

然后将项目导入文件->导入->导入现有项目并从新的位置进行选择。

Don't try to modify the eclipse files manually!

不要尝试手动修改eclipse文件!

#2


9  

Much more simple:

更简单:

Right click -> Refactor -> Move

右击->重构->移动。

.

#3


4  

You can go to [workspace]/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/ProjectName and try to edit .location which is the pointer to the project, but this file is purposely stored in binary. You Should Edit the location in file and some binary data ] the binary data that should edit , is bold :

您可以访问[工作区]/eclipse/.metadata/.plugins/org.eclipse.core.resources/。项目/ProjectName并尝试编辑.location,它是指向项目的指针,但该文件是故意存储在二进制文件中。您应该编辑文件的位置和一些二进制数据)应该编辑的二进制数据,是粗体的:

40 B1 8B 81 23 BC 00 14 1A 25 96 E7 A3 93 BE 1E 00 5D 55 52 49 2F 2F 66 69 6C 65 3A 2F 44 3A 2F 6D 61 64 64 61 68 2F 50 72 6F 6A 65 63 74 73 2F 46 6C 65 65 74 4D 61 6E 61 67 65 6D 65 6E 74 2F 54 79 70 65 73 2F 50 6F 72 74 61 62 6C 65 63 6F 64 65 2F 46 69 72 6D 77 61 72 65 2F 74 65 73 74 2F 43 50 50 2F 41 54 6D 65 61 67 38 4C 69 62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 58 FB F3 23 BC 00 14 1A 51 F3 8C 7B BB 77 C6

40 B1 8 b 81公元前23日00 96 96 25 E7 A3是1 e 00 5 d 55 52 49 2 f 2 66 69 6 c 69 3 2 f 44 3 2 6 d 61 64 64 61 61 2 f 72 6 6 65 63 74 73 2 f 46 6 c 65 65 74 4 d 65 6 e 61 67 65 6 d 65 6 e 65 2 f 54 79 70 65 73 72 74 61 62 50 6 f 6 c 65 65 6 64 65 2 f 46 69 72 6 d 72 61 72 65 2 43 50 50 74 65 73 74 2 f 2 f 41 54 6 d 4 c 65 61 67 65 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 58 FB F3公元前23 1 00 14 51 F3 8 c 7 b BB 77 C6

The Location of 0x11 of file, is the length of file name, that you should edit it. its value is the length of highlighted part

文件的0x11的位置,是文件名的长度,您应该编辑它。它的值是高亮部分的长度。

Also You Can Use ProjectLocationUpdater : https://marketplace.eclipse.org/content/projectlocationupdater/metrics

也可以使用ProjectLocationUpdater: https://marketplace.eclipse.org/content/projectlocationupdater/metrics。

#4


2  

I realise this is an old post however I thought I would add my own resolution to the same issue. I had imported a number of projects into my workspace from another machine. However the resource files would not build because for some reason Eclipse had marked the location of the projects incorrectly (using a mapped path instead of a unc path). This meant that each time I tried to reference libraries within the workspace they would tick green, then go red and fail. Despite the fact the libraries and the project where in the same workspace and I had followed the correct procedure for importing the projects.

我意识到这是一篇老文章,但我认为我应该把自己的解决方案添加到同样的问题上。我从另一台机器导入了一些项目到我的工作空间。但是,资源文件不会构建,因为某些原因Eclipse已经错误地标记了项目的位置(使用映射路径而不是unc路径)。这意味着每次我尝试在工作区中引用库时,它们都会标记绿色,然后红色和失败。尽管库和项目在同一个工作区中,我也遵循了导入项目的正确步骤。

As the OP mentions under properties there is a project location path. I noticed that the project location was different but for some bizarre reason Eclipse (in their almighty wisdom) do not allow you to reselect or change the path. In fact even trying the refactor->move fails because the project is already inside the workspace (never heard of generating a temp folder for moves?).

正如OP在属性中提到的,有一个项目位置路径。我注意到项目的位置是不同的,但是由于某种奇怪的原因Eclipse(在他们的万能智慧中)不允许您重新选择或更改路径。实际上,甚至尝试重构->移动失败,因为项目已经在工作区中(从未听说过生成一个用于移动的临时文件夹)。

However I did notice after looking at the file structure of the imported projects that Eclipse had added a .location file (mentioned above) which was actually absent from all other projects in the workspace. So I deleted the .location file, reopened eclipse and sure enough the projects build properly.

但是,在查看了Eclipse添加的导入项目的文件结构之后,我确实注意到了。location文件(上面提到过)实际上不在工作区中所有其他项目中。因此,我删除了.location文件,重新打开eclipse,并确保项目正确地构建。

So after wasting a few hours on something as silly as this I am now able to work and hopefully this might save you some trouble too.

所以,在浪费了几个小时之后,我现在能够工作了,希望这能给你省点麻烦。

#5


0  

You can change the .location file using a hex editor. However, you cannot simply replace the file location string stored there by the new one. You also have to edit the preceding byte defining its length (in bytes) accordingly. You may then re-open the project in Eclipse.

您可以使用十六进制编辑器更改.location文件。但是,不能简单地替换存储在新文件中的文件位置字符串。您还必须编辑前面的字节,并相应地定义其长度(以字节为单位)。然后,您可以在Eclipse中重新打开项目。

#6


0  

It is not advisable to change the .location file. The eclipse project list will be destroyed if you manually edit the .location file. I lost all the projects after modifying the file.

更改.location文件是不可取的。如果您手动编辑.location文件,eclipse项目列表将被销毁。修改文件后,我失去了所有的项目。

#7


-2  

Try this. Open eclipse --> Go to File --> switch workspace --> other --> choose your workspace by clicking the Browse button. Hope this will work.

试试这个。打开eclipse——>转到文件——>开关工作区——>其他——>通过点击Browse按钮选择您的工作空间。希望这将工作。