[
https://issues.apache.org/jira/browse/SUREFIRE-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14733900#comment-14733900
]
Mateusz Nowakowski commented on SUREFIRE-1176:
----------------------------------------------
It depends what perspective we choose.
We can say that the surefire plugin has a feature to change system feature by
changing system properties by its custom configuration systemPropertyVariables.
So in this case surefire can call TimeZone.setDefault(null) before changing
system properties - making user.timezone property working as expected.
Or we can also say that surefire only changes system properties, but it should
not be used to change system properties indicating some JVM features.
The first one is easier from client perspective.
> 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)