在我的 maven 项目中,我有不同的 log4j 配置用于开发和集成环境,也有不同的用于测试目的的配置,而不是我的 webapp 的主要用途。位于 :
- src/main/resources/dev/log4j.properties
- src/main/resources/int/log4j.properties
- src/test/resources/dev/log4j_test.properties
- src/test/resources/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 特定单元测试添加 gwt-maven-plugin。
<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,就像我为确保万无一失和故障安全所做的那样?*
谢谢,