Setting timezone for maven unit tests on Java 8
How do I set the timezone for unit tests in maven surefire on Java 8? With Java 7 this used to work with systemPropertyVariables like in the following configuration, but with Java 8 the tests just use the system timezone. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <systemPropertyVariables> <user.timezone>UTC</user.timezone> </systemPropertyVariables> Why is that, and how do I fix it? Wouter Coekaerts Short answer Java now reads user.timezone earlier, before surefire sets the properties in systemPropertyVariables . The