【问题标题】:Eclipse Maven update causes corruption of JVM settingEclipse Maven 更新导致 JVM 设置损坏
【发布时间】:2012-10-03 04:17:16
【问题描述】:

我有一个使用 maven(在 OSX、Juno 上运行)的 scala 项目设置。由于某些莫名其妙的原因,运行 m2e 更新会导致 JVM 更改为 1.7 JRE(我的系统上不存在,并且未设置)。

特别是,当我将项目导入 eclipse 时(首先通过 sbt 生成项目之后),这似乎发生了:

在.classpath中

<classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"></classpathentry>

更改为:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>

org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7 不存在(系统有 1.6)。

听起来 m2e 正在写这个,但我似乎无法找到如何/为什么,以及我可以在哪里更改此设置。

【问题讨论】:

  • 你能检查一下POM是否有maven-compiler-plugin的设置吗?如果有,这些设置是什么?
  • 谢谢,谢谢!就是这样:)

标签: java eclipse scala maven m2eclipse


【解决方案1】:

您的 POM 可能包含类似的内容

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

这将导致 m2e 更新您的项目以使用 Java 7。将 &lt;source&gt;1.7&lt;/source&gt; 更改为 &lt;source&gt;1.6&lt;/source&gt;(当然,&lt;target&gt; 也是如此),您应该准备好了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-29
    • 2016-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多