我正在将一些项目转换为 Maven 项目,但 m2e 更改了我的 .classpath JRE 条目:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
至:
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
这会导致一些错误,例如:
Description Resource Path Location Type Access restriction: The type WindowsPopupMenuSeparatorUI is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_20\jre\lib\rt.jar DottedJPopupMenuSeparator.java /acommons/src/com/ks/acommons/gui/lookandfeel line 10 Java Problem
有什么方法可以让 m2e 不生成 .classpath 文件,或者强制它使用工作区默认 JDK?
最佳答案
在我看来,Maven 正在帮助你。它强制 Eclipse 使用严格的 Java 1.6 环境,并阻止您使用不属于标准发行版的库。
通常,此错误消息暗示您应该声明新的 Maven 依赖项,而不是依赖于(例如)JRE/lib/ext
中存在的 JAR 文件。
关于java - 有什么方法可以阻止 m2e 修改 eclipse .classpath 文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12357380/