unit-testinglogginggwtjenkinsgwt-maven-plugin

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


On my maven project, I have a different log4j configuration for development and integration environment and also different ones for test purposes than for the main usage of my webapp. Located in :

So I have different profiles (DEV / INT) to manage thoses differences...

And for surefire (used for unit testing) and failsafe (used for integration testing) plugin I added some configuration :

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

But now I'm adding gwt-maven-plugin for GWT specific unit testing in DEV mode.

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

Is it possible to configure it to point on a specific / filtered lop4j as I did for surefire and failsafe ?*

Thanks,


Solution

  • You can pass system properties in extraJvmArgs