You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jon Bråten <va...@gmail.com> on 2009/04/23 21:38:57 UTC

maven-surefire-plugin and default locale

Is there a way to set the default locale to be used in JUnit tests run by
maven-surefire-plugin? I've tried adding "-Duser.language=nn" and
"-Duser.country=NN" to the maven command issued, but is does not affect the
test runs.

The issue at hand is, ofcourse, tests failing due to formatting variations
in amounts and alike. It can be discussed wether these tests are useful, and
either way its an alternative to hardcode the locale in the tests
themselves. But still, I'm curious as to why surefire appears to ignore the
locale specified at command line :)

Anyone?

Regards,
Jon B

Re: maven-surefire-plugin and default locale

Posted by sebb <se...@gmail.com>.
On 23/04/2009, Jon Bråten <va...@gmail.com> wrote:
> Is there a way to set the default locale to be used in JUnit tests run by
>  maven-surefire-plugin? I've tried adding "-Duser.language=nn" and
>  "-Duser.country=NN" to the maven command issued, but is does not affect the
>  test runs.
>
>  The issue at hand is, ofcourse, tests failing due to formatting variations
>  in amounts and alike. It can be discussed wether these tests are useful, and
>  either way its an alternative to hardcode the locale in the tests
>  themselves. But still, I'm curious as to why surefire appears to ignore the
>  locale specified at command line :)
>
>  Anyone?

I think that is because Maven runs the tests in a separate (forked)
process by default, so the properties are lost.

See:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/debugging.html

Try adding -DforkMode=none and see it that helps.

Otherwise see:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/system-properties.html

which describes how to define system properties in the POM.

>  Regards,
>  Jon B
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org