2
4

3 回答 3

14
于 2011-12-14T05:33:45.890 回答
1

检查您的 POM 文件。您可能已经为编译器插件配置了一个插件配置,告诉 Maven 使用 Java 1.3。有关详细信息,请参阅此页面

于 2011-12-14T05:34:39.737 回答
1

检查您的POM文件并添加您的编译器版本,如下所示。

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <verbose>true</verbose>
          <fork>true</fork>
          <executable><!-- path-to-javac --></executable>
          <compilerVersion><!-- compiler-version --></compilerVersion>
        </configuration>
      </plugin>
    </plugins>
    [...]
  </build>
  [...]
</project>

为避免对 java 路径进行硬编码,使其可执行,如下所示。

<executable>${JAVA_1_5_HOME}/bin/javac</executable>

转到您的服务器Settings.xml并创建如下配置文件。

<settings>
  [...]
  <profiles>
    [...]
    <profile>
      <id>compiler</id>
        <properties>
          <JAVA_1_5_HOME>C:\Program Files\Java\j2sdk1.5.2_09</JAVA_1_5_HOME>
        </properties>
    </profile>
  </profiles>
  [...]
  <activeProfiles>
    <activeProfile>compiler</activeProfile>
  </activeProfiles>
</settings>

它将帮助您检测您的JAVA_HOME

于 2011-12-14T05:47:07.747 回答