“无效的项目描述”,从 GIT 仓库导入问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6084056/
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-10 10:57:55  来源:igfitidea点击:

"Invalid project description", importing from GIT repo problem

eclipsegitegit

提问by James Raitsev

After copying my GITrepo from a PC computer onto my MAC, i can't seem to import it to an eclipse. Import happens via eGit plugin directly from existing local git repository.

将我的存储GIT库从 PC 计算机复制到我的 MAC 后,我似乎无法将其导入 Eclipse。通过 eGit 插件直接从现有的本地 git 存储库导入。

Same exact import works perfectly fine on existing Windows computer.

相同的精确导入在现有的 Windows 计算机上工作得非常好。

Please advise.

请指教。

org.eclipse.core.internal.resources.ResourceException: Invalid project description.
        at org.eclipse.core.internal.resources.Project.checkDescription(Project.java:162)
        at org.eclipse.core.internal.resources.Project.assertCreateRequirements(Project.java:52)
        at org.eclipse.core.internal.resources.Project.create(Project.java:274)
        at org.eclipse.core.internal.resources.Project.create(Project.java:256)
        at org.eclipse.egit.ui.internal.clone.ProjectUtils.createExistingProject(ProjectUtils.java:115)
        at org.eclipse.egit.ui.internal.clone.ProjectUtils.access
mvn eclipse:clean eclipse:eclipse 
(ProjectUtils.java:92) at org.eclipse.egit.ui.internal.clone.ProjectUtils.run(ProjectUtils.java:66) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957) at org.eclipse.egit.ui.internal.clone.ProjectUtils.createProjects(ProjectUtils.java:84) at org.eclipse.egit.ui.internal.clone.GitImportWizard.importProjects(GitImportWizard.java:160) at org.eclipse.egit.ui.internal.clone.GitImportWizard.access##代码##(GitImportWizard.java:142) at org.eclipse.egit.ui.internal.clone.GitImportWizard.run(GitImportWizard.java:83) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Contains: OK Contains: /Users/me/Repositories/ABC overlaps the location of another project: 'ABC'

回答by dunni

"Contains: /Users/me/Repositories/ABC overlaps the location of another project: 'ABC'"

“包含:/Users/me/Repositories/ABC 与另一个项目的位置重叠:'ABC'”

Looks like you already have a project in your workspace with the same name like the project you would like to import.

看起来您的工作区中已经有一个与您要导入的项目同名的项目。

回答by M. P.

Ok, i'll try to sum it up, after I faced similiary problems and wasted some time:

好的,在我遇到类似的问题并浪费了一些时间之后,我会尝试总结一下:

Eclipse Juno /4.2 SR1 (however I think it is a general misunderstanding of how ecplise imports projects)

Eclipse Juno /4.2 SR1(不过我认为这是对 ecplise 如何导入项目的普遍误解)

  1. If you want your new project "connected" to git/mercurial, you'll have to clone and import via "Import/Git/Import from Git"
  2. The import will fail if your "workspace dir" equals the "local destination dir". A git clone via egit MUST NOT be placed! in the "eclipse workspace dir"!
  1. 如果你想让你的新项目“连接”到 git/mercurial,你必须通过“Import/Git/Import from Git”克隆和导入
  2. 如果您的“工作区目录”等于“本地目标目录”,则导入将失败。 不得放置通过 egit 的 git 克隆!在“eclipse工作区目录”中!

The project import will fail because the projectname in the cloned ".project file" allready exists in the eclipse workspace dir when the import occurs.

项目导入将失败,因为在导入时克隆的“.project 文件”中的项目名称已经存在于 eclipse 工作区目录中。

Hope this saves some time.

希望这可以节省一些时间。

回答by Sunil Parmar

Following is worked for me.

Copy/put your project outside of workspace [e.g : E:\yourproject ], then Go to
1. File-->Import-->General-->Existing Projects into Workspace
2. Browse your project
3. Select Checkbox"Copy projects into workspace" and press Finish.
It will make copy of project into workspace.

以下对我有用。

将您的项目复制/放在工作区之外 [例如:E:\yourproject],然后转到
1. 文件--> 导入--> 常规--> 现有项目到工作区
2. 浏览您的项目
3.选择复选框“复制项目”进入工作区”,然后按完成。
它会将项目复制到工作区。

回答by Andre Charton

Try to use different directories for workspace and git project. Workspace -> wsp, Git-Project -> wsp/git-project instead of: Workspace/Git-Project -> git-project

尝试为工作区和 git 项目使用不同的目录。Workspace -> wsp, Git-Project -> wsp/git-project 而不是:Workspace/Git-Project -> git-project

回答by alexuz

I've meet the same issue and after some time found following solution to remain git repo:

我遇到了同样的问题,一段时间后找到了以下解决方案来保持 git repo:

  1. remove project from workspace (it's there even if eclipse says about failure)
  2. import project as "Import -> General -> Existing Projects into Workspace"
  3. repair repo as "Team -> Share project -> Git -> "
  1. 从工作区中删除项目(即使 eclipse 说失败,它也在那里)
  2. 将项目导入为“导入 -> 常规 -> 现有项目到工作区”
  3. 将 repo 修复为“团队 -> 共享项目 -> Git -> ”

Just one more note, your project shall contain .git folder

再多注意一点,您的项目应包含 .git 文件夹

It's working fine for me

这对我来说很好用

回答by manojlds

You have ABCalready in your workspace. Remove it and then add this one.

ABC已经在您的工作区中了。删除它,然后添加这个。

回答by Marcus Wolschon

This happens when cloning a remote git repository using import project -> project from git in the last step.

在最后一步中使用 import project -> project from git 克隆远程 git 存储库时会发生这种情况。

回答by BIOHAZARD

Hm I had similar problem with git repos (cloned from command line using git tool): Eclipse was damaging .git index inside project dir when I was importing projects cloned inside eclipse workspace. Than I cloned git repo outside workspaceand imported in eclipse using "copy into workspace"checkbox and everything worked smoothly...

嗯,我遇到了与 git repos 类似的问题(使用 git 工具从命令行克隆):当我导入在 eclipse 工作区中克隆的项目时,Eclipse 正在损坏项目目录中的 .git 索引。比我在工作区外克隆 git repo使用“复制到工作区”复选框在 Eclipse 中导入,一切都运行顺利......

But it is worth to mention that I downloaded Eclipse Classic which comes without egitor without any git related plugins, because I had suspect that this egit plugin was resetting .git directory besides other import problems.

但值得一提的是,我下载了Eclipse Classic,它没有 egit或没有任何与 git 相关的插件,因为我怀疑这个 egit 插件除了其他导入问题之外正在重置 .git 目录。

Maybe importing outside working dir is something what eclipse programmers want from us.

也许导入外部工作目录是 eclipse 程序员想要我们的东西。

回答by Nivedita Velagaleti

Please do check this out. I had a multi level project. I was not able to import one of my subprojects because it gave me "invalid project description, resource contains /". This was because my subprojects had apply plugin: 'eclipse' I think so. This is a known issue and there is a bug created for it: https://issuetracker.springsource.com/browse/STS-2614

请务必检查一下。我有一个多层次的项目。我无法导入我的子项目之一,因为它给了我“无效的项目描述,资源包含 /”。这是因为我的子项目有 apply plugin: 'eclipse' 我认为是这样。这是一个已知问题,并为其创建了一个错误:https: //issuetracker.springsource.com/browse/STS-2614

回答by anandxp

##代码##

I run above command from terminal and build issues in eclipse were resolved.

我从终端运行上面的命令并解决了 eclipse 中的构建问题。