gwt-maven-plugin 加载 "main" log4j 配置而不是 "test" 配置

gwt-maven-plugin does load the "main" log4j configuration instead of the "test" one

在我的 maven 项目中,我有不同的 log4j 配置用于开发和集成环境,也有不同的用于测试目的的配置,而不是用于我的 webapp 的主要用途。位于:

所以我有不同的配置文件 (DEV / INT) 来管理这些差异...

我为 surefire(用于单元测试)和 failsafe(用于集成测试)插件添加了一些配置:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <version>2.19.1</version>
  <executions>
    <execution>
    <goals>
      <goal>integration-test</goal>
      <goal>verify</goal>
    </goals>
    </execution>
  </executions>
  <configuration>
    <systemPropertyVariables>
    <log4j.configuration>file:${basedir}/${profile.test.resource}/log4j_test.properties</log4j.configuration>
    </systemPropertyVariables>
    <!-- Stop the integration tests after the first failure to keep in database
    the content of the failed test. -->
    <skipAfterFailureCount>1</skipAfterFailureCount>
    <includes>
    <!-- Include only integration tests -->
    <include>**/*IntegrationTest.java</include>
    </includes>
    <skip>${skip.integration.tests}</skip>
  </configuration>
</plugin>

但现在我正在添加 gwt-maven-plugin 以在 DEV 模式下进行特定于 GWT 的单元测试。

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>2.7.0</version>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>i18n</goal>
        <goal>generateAsync</goal>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>

  <configuration>
    <runTarget>Appication.html</runTarget>
    <webappDirectory>${webappDirectory}</webappDirectory>
    <hostedWebapp>${webappDirectory}</hostedWebapp>
    <i18nMessagesBundles>
      ...               
    </i18nMessagesBundles>

    <extraJvmArgs>${gwt.extra.args}</extraJvmArgs>
    <style>${compile.style}</style>
    <module>${module.name}</module>
  </configuration>
</plugin>

是否可以像我为 surefire 和 failsafe 所做的那样将其配置为指向特定的/过滤的 lop4j?*

谢谢,

您可以在 extraJvmArgs

中传递系统属性