gwt-maven-plugin中的其他类路径条目

时间:2013-04-10 09:18:39

标签: maven gwt classpath

我需要在执行gwt:test`时设置一些额外的类路径条目。 它们主要包含属性文件,仅在运行时需要。

我必须在我的pom中设置哪个配置参数才能获得其他类路径条目?

我当前的gwt-maven-plugin配置看起来像(pom的片段):

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>${gwtVersion}</version>
    <executions>
      <execution>
        <goals>
          <goal>compile</goal>
          <goal>test</goal>
          <goal>i18n</goal>
          <goal>generateAsync</goal>
        </goals>
        <configuration>
          <extraJvmArgs>-Xmx1024M -Xss512M</extraJvmArgs>
        </configuration>
      </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
         documentation at codehaus.org -->
    <configuration>
      <mode>htmlunit</mode>
      <runTarget>Myproject.html</runTarget>
      <out>${webappDirectory}</out>
      <hostedWebapp>
        ${project.build.directory}/${project.build.finalName}
      </hostedWebapp>
      <i18nMessagesBundle>myproject.web.client.Messages</i18nMessagesBundle>
    </configuration>
  </plugin>

我正在使用gwt 2.5.1。我已经花了比预期更多的时间来处理这个小问题。

1 个答案:

答案 0 :(得分:2)

gwt:test将使用标准的Maven测试类路径,包括与<scope>test</scope>testResources目录相关的资源依赖项。

假设您的属性文件是Maven模块的本地文件,只需将它们放在src/test/resources中,或将相应的父文件夹添加为testResource

<build>
  <testResources>
    <testResource>
      <directory>${basedir}/src/test/resources</directory>
    </testResource>
    <testResource>
      <directory>${basedir}/src/test-properties-files</directory>
    </testResource>
  </testResources>
相关问题