我正在尝试在使用mvn gwt:run
启动的托管模式下运行的GWT应用程序上设置系统属性。从事物的外观来看,这个属性并没有被设定。在我的pom.xml
中,插件配置为: -
<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>
答案 0 :(得分:10)
有关gwt-maven-plugin的信息,请参阅Compile Guide。您可以使用extraJvmArgs
元素。
<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:run goal
,但将extraJvmArgs移动到插件(而非执行)配置中: -
<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>
答案 1 :(得分:2)
systemProperties不是属性,而是地图
像这样使用:
<systemProperties>
<configDir>${basedir}/local/staging</configDir>
</systemProperties>