用指定的jvm编译gwt



我试图在我的maven settings.xml和我的pom.xml中指定用于我的gwt项目的jvm。

我正在使用https://stackoverflow.com/a/20787334/265119的建议。我已经在其他非gwt项目中成功地使用了它。

但是现在maven似乎忽略了这一点,并继续使用java 8,而我在settings.xml中设置了以下内容:

<profiles>        
<profile>
<id>default</id>
    <properties>
            <JAVA_1_7_HOME>/usr/lib/jvm/java-7-oracle/bin/javac</JAVA_1_7_HOME>
            <JAVA_1_8_HOME>/usr/lib/jvm/java-8-oracle/bin/javac</JAVA_1_8_HOME>
        </properties>
</profile>
  </profiles>
  <activeProfiles>
    <activeProfile>default</activeProfile>
</activeProfiles>

在my pom.xml中:

 <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <executable>${JAVA_1_7_HOME}</executable>
                    </configuration>
                </plugin>

有人知道为什么maven忽略了这些吗?gwt maven插件还需要指定jvm版本吗?

谢谢

配置文件真的被激活了吗?您的POM应该工作,但只有在配置文件被激活的情况下。

您可以运行mvn help:active-profiles来查看您的配置文件是否激活。

同样,为了使<executable>工作,您也需要设置<fork>true</fork>。如下所示:http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#executable