gwt-maven-plugin:如何在pom.xml中为gwt:run目标设置系统属性? [英] gwt-maven-plugin: How to set system properties for the gwt:run goal in the pom.xml?

查看:421
本文介绍了gwt-maven-plugin:如何在pom.xml中为gwt:run目标设置系统属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在使用 mvn gwt:run 启动的托管模式下运行的GWT应用程序上设置系统属性。该物业没有设置,通过外观的东西。在我的 pom.xml 中,插件配置为:

I'm trying to set a system property on a GWT application running in hosted mode launched using mvn gwt:run. The property isn't getting set, by the looks of things. In my pom.xml the plugin configuration is: -

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>2.2.0</version>
  <executions>
    <execution>
      <configuration>
        <module>com.foo</module>
      </configuration>
      <goals>
        <goal>compile</goal>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <runTarget>index.html</runTarget>
    <hostedWebapp>${webappDirectory}</hostedWebapp>
    <systemProperties>
      <property>
        <name>configDir</name>
        <value>${basedir}/local/staging</value>
      </property>
    </systemProperties>
  </configuration>
</plugin>


推荐答案

请参阅编译指南为gwt-maven-plugin。您可以使用 extraJvmArgs 元素。

See Compile Guide for gwt-maven-plugin. You can use the extraJvmArgs element.

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.2.0</version>
    <executions>
      <execution>
        <configuration>
          <extraJvmArgs>-Xmx512M -Xss1024k -Dfoo=bar</extraJvmArgs>
        </configuration>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

编辑:原来这不适用于 gwt:运行目标,但将extraJvmArgs移动到插件(而不是执行)配置中: -

This turned out not to work for the gwt:run goal, but moving the extraJvmArgs into the plugin (rather than execution) configuration did: -

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.2.0</version>
    <configuration>
      <extraJvmArgs>-Xmx512M -Xss1024k -Dfoo=bar</extraJvmArgs>
    </configuration>
  </plugin>

这篇关于gwt-maven-plugin:如何在pom.xml中为gwt:run目标设置系统属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆