使用eclipse Helios和galileo的maven-compiler-plugin

时间:2015-11-18 14:27:00

标签: eclipse maven maven-plugin

我的maven-compiler-plugin有问题: 当我做命令时: mvn eclipse:清除日食:日蚀 结果:

<?php
    $query=mysql_query("SELECT key FROM table");
    while($get=mysql_fetch_array($query)) {
        $k=$get['key'];
    }
?>

在工作区,文件.classpath我有这个:

[INFO] >>> maven-eclipse-plugin:2.10:eclipse (default-cli) @ XXXXXXXX >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.10:eclipse (default-cli) @ XXXXXXXX <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.10:eclipse (default-cli) @ GT_XXXXXXXX ---
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5
...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

enter image description here

但我的问题是我喜欢在Eclipse中将JRE_CONTAINER设置为Workspace默认JRE。 我的默认JRE是另一个(你可以在图像中看到它),结果如下:

<classpath>
    ....
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
  ....
</classpath>

我在eclipse Helios su windows和eclipse galileo su Ubuntu中尝试过,但我一直都有问题

信息:

的pom.xml

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

的Maven:

      ....
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <encoding>utf8</encoding>
        </configuration>
      </plugin>
      ....

1 个答案:

答案 0 :(得分:0)

找到解决方案。 解决方案设置为maven-compiler-plugin pom.xml,如下所示:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
      <classpathContainers>
           <classpathContainer>
org.eclipse.jdt.launching.JRE_CONTAINER
           </classpathContainer>
          </classpathContainers>
          <encoding>utf8</encoding>
        </configuration>
      </plugin>

TKS