Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gwt-maven-plugin: How to set system properties for the gwt:run goal in the pom.xml?

Tags:

maven-2

gwt

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>
like image 935
Jim Downing Avatar asked Dec 17 '22 14:12

Jim Downing


1 Answers

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>
like image 163
Valdis R Avatar answered Dec 27 '22 09:12

Valdis R