在我的maven项目中,我有一个不同的log4j配置用于开发和集成环境,也有不同的log4j配置用于测试目的,而不是用于我的web应用程序的主要用途。位于:
- src/main/资源/dev/log4j . properties的
- src/main/资源/int/log4j . properties的
- src/测试/资源/dev/log4j_test.properties
- src/测试/资源/int/log4j_test.properties
所以我有不同的配置文件(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>
但是现在我在DEV模式下添加GWT -maven-plugin用于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>
是否可以将其配置为指向特定的/过滤的lop4j,就像我为surefire和failsafe所做的那样?*
谢谢,
可以在extraJvmArgs中传递系统属性