eclipse 在“更新 Maven 项目”期间发生内部错误。不支持的 IClasspathEntry kind=4

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

An internal error occurred during: "Updating Maven Project". Unsupported IClasspathEntry kind=4

eclipsemavenm2eclipsepom.xml

提问by Vjeetje

As the title mentioned I have the following problem: I use Eclipsewith Maven Natureand when I update my Maven Project, I get this error:

正如标题所提到的,我有以下问题:我用EclipseMaven Nature,当我更新我的Maven项目,我得到这个错误:

An internal error occurred during: "Updating Maven Project".
Unsupported IClasspathEntry kind=4

在“更新 Maven 项目”期间发生内部错误。
不支持的 IClasspathEntry kind=4

The solution that always comes back is the following:

总是回来的解决方案如下:

  • rightclick project, remove maven nature
  • mvn eclipse:clean(with project open in eclipse/STS)
  • (sometimes they suggest to do mvn eclipse:eclipsenext)
  • rightclick project and reenable maven nature
  • 右键单击项目,删除 maven 性质
  • mvn eclipse:clean(在 eclipse/STS 中打开项目)
  • (有时他们建议mvn eclipse:eclipse下一步做)
  • 右键单击项目并重新启用 Maven 性质

Now I exhaustively tried all combinations several times. But I always keep getting the above error. The error starting occurring when I had to mvn eclipse:eclipsethe project. Before it was always running fine using only m2eclipsefeatures and setting everything in eclipse.

现在我彻底尝试了所有组合几次。但我总是不断收到上述错误。当我不得不进行mvn eclipse:eclipse项目时,错误开始发生。在它只使用m2eclipse功能并在 eclipse 中设置所有内容之前它总是运行良好。

回答by Vjeetje

I had to do it slightly different to work for me:

为了对我来说有效,我不得不做一些稍微不同的事情:

  1. rightclick project, remove maven nature (or in newer eclipse, "Maven->Disable Maven Nature")
  2. mvn eclipse:clean(with project open in eclipse/STS)
  3. delete the project in eclipse (but do not delete the sources)
  4. Import existing Maven project
  1. 右键单击项目,删除 Maven 自然(或在较新的 Eclipse 中,“Maven->禁用 Maven 自然”)
  2. mvn eclipse:clean(在 eclipse/STS 中打开项目)
  3. 在 eclipse 中删除项目(但不要删除源)
  4. 导入现有的 Maven 项目

回答by Wiebke

  • I just went to Properties-> Java Build Path-> Librariesand removed the blue entries starting with M2_REPO.

  • After that, I could use Maven-> Update Projectagain

  • 我刚刚去了Properties-> Java Build Path->Libraries并删除了以M2_REPO开头的蓝色条目。

  • 之后,我可以再次使用Maven->Update Project

回答by tharindu_DG

This is all you need:

这就是你所需要的:

  1. Right-click on your project, select Maven -> Remove Maven Nature.

  2. Open you terminal, navgate to your project folder and run mvn eclipse:clean

  3. Right click on your Project and select Configure -> Convert into Maven Project

  4. Right click on your Project and select Maven -> Update Project

  1. 右键单击您的项目,选择 Maven -> Remove Maven Nature

  2. 打开你的终端,导航到你的项目文件夹并运行 mvn eclipse:clean

  3. 右键单击您的项目并选择 Configure -> Convert into Maven Project

  4. 右键单击您的项目并选择 Maven -> Update Project

回答by mitunome

After trying all these procedures it still didn't work for me. What did work was

在尝试了所有这些程序后,它仍然对我不起作用。什么工作是

  1. go into File Explorer and delete the .classpath file under the project's root folder
  2. run Maven update within Eclipse, and check Force update of Snapshots/Releases
  1. 进入文件资源管理器并删除项目根文件夹下的 .classpath 文件
  2. 在 Eclipse 中运行 Maven 更新,并检查强制更新快照/发布

Our current work required integrating a number of disparate projects so unfortunately use of SNAPSHOTs in a production environment were required (taboo in Maven circles)!

我们当前的工作需要集成许多不同的项目,因此不幸的是,需要在生产环境中使用 SNAPSHOT(Maven 圈子中的禁忌)!

回答by Fred Bricon

This issue (https://bugs.eclipse.org/394042) is fixed in m2e 1.5.0 which is available for Eclipse Kepler and Luna from this p2 repo :

这个问题 ( https://bugs.eclipse.org/394042) 在 m2e 1.5.0 中得到修复,它可用于 Eclipse Kepler 和 Luna 从这个 p2 repo :

http://download.eclipse.org/technology/m2e/releases/1.5

http://download.eclipse.org/technology/m2e/releases/1.5

If you also use m2e-wtp, you'll need to install m2e-wtp 1.1.0 as well :

如果您还使用 m2e-wtp,则还需要安装 m2e-wtp 1.1.0:

http://download.eclipse.org/m2e-wtp/releases/luna/1.1

http://download.eclipse.org/m2e-wtp/releases/luna/1.1

回答by Helio Bentzen

I solved this by looking at this comment on JBIDE-11655 : deleting all .project, .settings and .classpath in my projects folder.

我通过查看 JBIDE-11655 上的这条评论解决了这个问题:删除我的项目文件夹中的所有 .project、.settings 和 .classpath。

回答by aan

I imported the project as general project from git repository.

我从 git 存储库中将项目作为一般项目导入。

  • Deleted .settings, .projectand .classpathin project's folder
  • Configure -> Convert to Maven Project. Only this solved the problem in my case.
  • 已删除.settings.project.classpath在项目的文件夹中
  • Configure -> Convert to Maven Project. 只有这解决了我的问题。

回答by QuangHao

I have that problem and my solution is going source folder and run command line: mvn clean install -DskipTests eclipse:eclipsethen return eclipse workspace and refresh project. Hope that help!

我有这个问题,我的解决方案是转到源文件夹并运行命令行:mvn clean install -DskipTests eclipse:eclipse然后返回 eclipse 工作区并刷新项目。希望有所帮助!

回答by eadjei

Your command line mvn eclipse project generator may not be the same version as that of your eclipse, and eclipse doesn't understand for your command line tool is generating. Just use eclipse's in this case:

您的命令行 mvn eclipse 项目生成器可能与您的 eclipse 版本不同,并且 eclipse 无法理解您的命令行工具正在生成。在这种情况下只需使用 eclipse :

  • remove the project from eclipse (including all modules if multi-module)
  • run: rm -rf .settings/ .project .classpathto delete eclipse project files, also from modules
  • import your project as an existing maven project
  • 从 Eclipse 中删除项目(如果是多模块,则包括所有模块)
  • 运行:rm -rf .settings/ .project .classpath删除 eclipse 项目文件,也从模块中删除
  • 将您的项目作为现有的 Maven 项目导入

回答by asilchenko

Slightly different option usually works for me:

略有不同的选项通常对我有用:

  1. "mvn eclipse:eclipse" for this project in the command line.
  2. "Refresh/F5" this project in eclipse.
  1. 命令行中此项目的“mvn eclipse:eclipse”。
  2. 在 Eclipse 中“刷新/F5”这个项目。

That's all, no need to re-import but need to have the terminal window handy.

就是这样,不需要重新导入,但需要方便的终端窗口。