本文介绍了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:run 目标
,但是将 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 目标设置系统属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!