【问题标题】:gwt-maven-plugin: How to set system properties for the gwt:run goal in the pom.xml?gwt-maven-plugin:如何在 pom.xml 中为 gwt:run 目标设置系统属性?
【发布时间】:2011-04-28 15:25:27
【问题描述】:

我正在尝试在使用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>

【问题讨论】:

    标签: gwt maven-2


    【解决方案1】:

    有关 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>
    

    【讨论】:

    • 这对运行目标不起作用,但将extraJvmArgs 元素添加为plugin 的子元素(而不是execution)确实有效。任何想法为什么?
    【解决方案2】:

    systemProperties 不是属性而是地图

    像这样使用它:

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

    【讨论】:

    • configDir 是怎样的地图?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-08
    • 2014-12-19
    • 2012-02-18
    • 2014-07-09
    • 2011-03-08
    • 2013-09-05
    • 2015-09-12
    相关资源
    最近更新 更多