开发者

gwt-maven-plugin: How to set system properties for the gwt:run goal in the 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>
  &l开发者_JAVA百科t;/executions>
  <configuration>
    <runTarget>index.html</runTarget>
    <hostedWebapp>${webappDirectory}</hostedWebapp>
    <systemProperties>
      <property>
        <name>configDir</name>
        <value>${basedir}/local/staging</value>
      </property>
    </systemProperties>
  </configuration>
</plugin>


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>

Edit: 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>


systemProperties are not properties but a map

Use it like this :

<systemProperties>
      <configDir>${basedir}/local/staging</configDir> 
</systemProperties>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜