Eclipse 类似于:“无法确定 [项目名称]/[文件路径]/[文件名称] 的 URI”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30978065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:42:58  来源:igfitidea点击:

Eclipse be like : "Cannot determine URI for [project-name]/[file-path]/[file-name]"

javaeclipsefile

提问by Ar3s

Main issue :

主要问题 :

I've encountered the following error on Eclipse Luna :

我在 Eclipse Luna 上遇到了以下错误:

You come one day at work and try to launch eclipse and be productive but as soon as your workbench opens you see that all your file tabs are in error like :

有一天,您上班并尝试启动 eclipse 并提高工作效率,但是一旦您的工作台打开,您就会看到所有文件选项卡都出现错误,例如:

Cannot determine URI for 'my-project/path/to/file/filename.extension'

无法确定“my-project/path/to/file/filename.extension”的 URI

And if I check in my navigator/explorer views I see none of my projects.

如果我检查我的导航器/资源管理器视图,我将看不到我的任何项目。

The first couple times I did as recomended to other people who faced the same problem :

前几次我建议其他面临同样问题的人:

I re-created my projects under eclipse.

我在 eclipse 下重新创建了我的项目。



But :

但 :

  • the project has grown bigger (more and more sub-projects to re-create each time)
  • this problem is growing more and more frequent
  • I am growing weary of the manual work it requires
  • 项目变得越来越大(每次都重新创建越来越多的子项目)
  • 这个问题越来越频繁
  • 我越来越厌倦它需要的体力劳动

So I am not satisfied with the solution at hand.

所以我对手头的解决方案并不满意

Therefore I am looking for a some sort of way to fix this issue automatically (with come sort of script or set of command lines) or at least some way to prevent this from happening.

因此,我正在寻找某种方法来自动解决此问题(使用某种脚本或一组命令行)或至少某种方法来防止这种情况发生。



My progression so far :

到目前为止我的进展:

I have delved into the workspace folder :

我已经深入研究了工作区文件夹:

workspace
└── .metadata
 ?? └── .plugins
 ??  ?? └── org.eclipse.core.resources
 ??  ??  ?? └── .projects
 ??  ??  ??  ?? ├── project1-newName
                ├── project1-oldName
                ├── project2-newName
 ??  ??  ??  ?? └── project2-oldName

So my projects's metadas are still there !?

所以我的项目的元数据还在那里!?

If I dig a bit further I see that each and every folder is organized as follows

如果我进一步挖掘,我会看到每个文件夹的组织方式如下

.
├── .indexes
│?? └── [...]
├── .location
├── .markers
├── org.eclipse.jdt.apt.core
└── org.eclipse.jdt.core
    └── state.dat

Where

在哪里

  • .indexescontains a fat-mambo-jambo-of-split-index-tree-organizationcontaining a history.indexon each leaves
    • (does not seem thatrelevant to my issue)
  • .markersis empty
  • state.datis empty
  • .locationcontains the string URI//file:/home/myname/projects/my/project/source/folderamidst some scramble chars like @??#%?磓
  • .indexes包含一个fat-mambo-jambo-of-split-index-tree-organizationhistory.index在每个叶子上 包含一个
    • (似乎不有关我的问题)
  • .markers是空的
  • state.dat是空的
  • .locationURI//file:/home/myname/projects/my/project/source/folder在一些打乱字符中包含字符串,例如@??#%?磓

I'm pretty sure that the solution lies within this .locationfile.

我很确定解决方案就在这个.location文件中。



Conclusion :

结论 :

Has anyone any clue as to why eclipse can't suddenly read it's own files and How to make it see and recognise them again ?

有没有人知道为什么 eclipse 不能突然读取它自己的文件以及如何让它再次看到和识别它们?

回答by Smug

You can solve the problem by trying this:

您可以尝试以下操作来解决问题:

  • Right click Package Explorer
  • Select Import
  • General> Existing Projects into Workspace> Navigate to the project
    folder(Select root directory)
    > select the Project.
  • Finish. This will certainly solve your problem.
  • 右键单击包资源管理器
  • 选择导入
  • 常规>现有项目进入工作区>导航到项目
    文件夹(选择根目录)
    >选择项目。
  • 结束。这肯定会解决您的问题。

If this doesn't work proceed to File System (General>FileSystem) and select the project files.

如果这不起作用,请转到文件系统(General>FileSystem)并选择项目文件。

First method is quite easy and works perfectly in most cases.

第一种方法非常简单,并且在大多数情况下都可以完美运行。

回答by Ravi Agrawal

I faced the same issue. The above suggested method does not work in my case as Package Explorer -> Export option remains disabled. So I chose to create another workspace in Eclipse and followed the steps Import-> General -> Existing Projects into Workspace.

我遇到了同样的问题。上述建议的方法在我的情况下不起作用,因为 Package Explorer -> Export 选项保持禁用状态。所以我选择在 Eclipse 中创建另一个工作区并按照步骤操作Import-> General -> Existing Projects into Workspace

It worked fine after the Build Workspace was complete.

构建工作区完成后,它运行良好。