不会导出类路径条目 org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6799503/
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
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
提问by user710818
I'm getting this warning in Eclipse:
我在 Eclipse 中收到此警告:
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result
类路径条目 org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER 不会被导出或发布。可能会导致运行时 ClassNotFoundExceptions
After searching I found that I need fix export. I did it.
搜索后我发现我需要修复导出。我做到了。
But this warning persists! What else can be done to fix it? Thanks.
但是这个警告仍然存在!还能做些什么来修复它?谢谢。
采纳答案by dcompiled
I had tried both of the options but only the latter is what you need:
我已经尝试了这两种选择,但只有后者才是你所需要的:
- Mark the associated raw classpath entry as a publish/export dependency
- Exclude the associated raw classpath entry from the set of potential publish/export dependencies
- 将关联的原始类路径条目标记为发布/导出依赖项
- 从潜在的发布/导出依赖项集中排除关联的原始类路径条目
If you export the dependency, refreshing the project configuration via Maven -> Update Project Configurationcontext menu will cause the warning to return. In this case you need to edit the .classpath file by hand:
如果导出依赖项,通过Maven -> Update Project Configuration上下文菜单刷新项目配置将导致警告返回。在这种情况下,您需要手动编辑 .classpath 文件:
<classpathentry kind="con" exported="true" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
Simply delete have the attribute exported="true"
and confirm by refreshing the project configuration.
只需删除具有属性exported="true"
并通过刷新项目配置进行确认。
回答by Alin Stoian
You can right click on the warning, choose quickfix and choose one of the following:
您可以右键单击警告,选择 quickfix 并选择以下选项之一:
- Mark the associated raw classpath entry as a publish/export dependency.
- Exclude the associated raw classpath entry from the set of potential publish/export dependencies.
- 将关联的原始类路径条目标记为发布/导出依赖项。
- 从潜在的发布/导出依赖项集中排除关联的原始类路径条目。
As you will not have eclipse publishing/exporting the project it is safe to exclude it. But either way it makes no difference
由于您不会让 eclipse 发布/导出项目,因此可以安全地排除它。但无论哪种方式都没有区别
Step by step screenshots:
http://publib.boulder.ibm.com/infocenter/radhelp/v8/index.jsp?topic=/com.ibm.javaee.doc/topics/tlooseclasspath.html
分步截图:http:
//publib.boulder.ibm.com/infocenter/radhelp/v8/index.jsp?topic=/com.ibm.javaee.doc/topics/tlooseclasspath.html
回答by Frank Rünagel
I had the same problem; it vanishes after including
我有同样的问题; 它在包含后消失
<packaging>war</packaging>
in the pom. There was no packaging at all.
在 pom. 根本没有包装。
回答by gooooooogling
On certain occasions Eclipse will present you with the following warning:
在某些情况下,Eclipse 会向您显示以下警告:
Classpath entry org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result.
So solve this, do the following:
所以解决这个问题,请执行以下操作:
Open the properties of the project that generates this warning
Click on “Java Build Path”
Click on the tab “Order and Export”
Enable “Maven Dependencies”
Click on “Ok”
Open the “Problems” view
Select the warning we are trying to solve, and press “Ctrl-1″
Click on “Ok”
The problem is now solved. It may take some time before the warning disapears because the project needs to rebuild before it goes away.
现在问题解决了。警告消失可能需要一些时间,因为项目需要在它消失之前重建。
回答by Fangming
回答by borjab
I wasn't able to solve the problem with the quickfix in Eclipse Luna. The problem disappeared after removing the Project Facet "Dynamic Web _Module". In Windows -> Preferences -> Project Facets.
我无法通过 Eclipse Luna 中的快速修复解决问题。删除项目构面“Dynamic Web _Module”后问题消失。在 Windows -> 首选项 -> 项目方面。
P.S. Packaging as War also solved the issued but it was suppoused to be a JAR and I was puzzled why some projects worked ok and some didn't.
PS Packaging as War 也解决了这个问题,但它被认为是一个 JAR,我很困惑为什么有些项目可以正常工作而有些却没有。
And by the way, the warning was real. It caused a ClassNotFoundExceptions exceptions in the server that made it unsusable when other projects referenced this.
顺便说一下,警告是真实的。它在服务器中导致 ClassNotFoundExceptions 异常,使其在其他项目引用时无法使用。
回答by Marcel Korpel
Most answers, including the currently accepted one, only provide a temporary solution to this issue: every time I chose Maven > Update Project… andleaving the option 'Update project configuration from pom.xml' on, the warning came back.
大多数答案,包括目前接受的答案,都只是为这个问题提供了一个临时解决方案:每次我选择 Maven > Update Project...并保留“从 pom.xml 更新项目配置”选项时,警告又回来了。
However, after installing m2e-wtp - Maven Integration for WTP
in Eclipse 4.5 (Mars) and issuing Update Project… again, while leaving the option selected, the warning (and resulting error) went away.
但是,m2e-wtp - Maven Integration for WTP
在 Eclipse 4.5 (Mars) 中安装并再次发出 Update Project... 后,在选择该选项的同时,警告(以及由此产生的错误)消失了。
回答by Aaron Digulla
None of the answers helped in my case. Every time I update the project, m2e will delete the entry from the .classpath file which disables the warnings.
在我的情况下,所有答案都没有帮助。每次我更新项目时,m2e 都会从禁用警告的 .classpath 文件中删除条目。
I've now filed a bug report: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537401
我现在提交了一个错误报告:https: //bugs.eclipse.org/bugs/show_bug.cgi?id=537401
回答by Moco
I have a simple way to solve this problem:
我有一个简单的方法来解决这个问题:
- Delete the project from your Eclipse.
- Into the work space where the project is located.
Delete the items selected in the following image. Just leave
src
andpom.xml
.Re-import the project in your Eclipse.
回答by Remi Patriarche
Using Eclipse Photon, the configuration below fixed the problem for me:
Window > Preferences > Maven > Java EE Integration > Enable Java EE Configuration
使用 Eclipse Photon,下面的配置为我解决了这个问题:
Window > Preferences > Maven > Java EE Integration > Enable Java EE Configuration
Note that I disabled this option before receiving the warning
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
请注意,我在收到警告之前禁用了此选项
Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
All other options may not be checked if you do not need them.
如果您不需要所有其他选项,则可能不会选中它们。
The warning does not reappear after a Maven update.
Maven 更新后,警告不会再次出现。