Mateusz Nowakowski created SUREFIRE-1176:
--------------------------------------------
Summary: Maven surefire plugin sets systemPropertyVariables too
late
Key: SUREFIRE-1176
URL: https://issues.apache.org/jira/browse/SUREFIRE-1176
Project: Maven Surefire
Issue Type: Bug
Components: Maven Surefire Plugin
Affects Versions: 2.18.1
Reporter: Mateusz Nowakowski
I have a couple of test which need to be run under specific locale.
It is achieved by this surefire plugin configuration:
Under Java 7 this plugin configuration works:
{code}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<systemPropertyVariables>
<user.timezone>America/Chicago</user.timezone>
</systemPropertyVariables>
</configuration>
</plugin>
{code}
but under Java 8 the test sensitive test still uses default system locale and
they fail.
Surefire plugin sets system properties too late, because in Java 8, several
locale-dependent variables are set much earlier than in Java 7, e.g.
TimeZone.getDefault() and
properties specified in systemPropertyVariables section don't have influence on
tests.
Workaround for it is setting system properties in argLine section, e.g.
<argLine>-Duser.timezone=America/Chicago</argLine>.
Workaround:
{code}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Duser.timezone=America/Chicago</argLine>
</configuration>
</plugin>
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)