1

我有一个使用 maven 的 scala 项目设置(在 OSX、Juno 上运行)。由于某些莫名其妙的原因,运行 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 正在写这个,但我似乎无法找到如何/为什么,以及我可以在哪里更改此设置。

4

1 回答 1

3

您的 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。更改<source>1.7</source><source>1.6</source>(当然,同样适用于<target>),您应该准备好了。

于 2012-10-12T11:08:00.130 回答