maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephan Schroevers (JIRA)" <>
Subject [jira] (SUREFIRE-951) Better handling of file.encoding system property
Date Tue, 15 Jan 2013 11:29:13 GMT


Stephan Schroevers commented on SUREFIRE-951:

Thinking about it some more, I guess any unit test that relies on a _specific_ default encoding
is faulty, so the case can be made that point (1) above _should not be_ necessary. Would like
to hear other people's thoughts on that.
> Better handling of file.encoding system property
> ------------------------------------------------
>                 Key: SUREFIRE-951
>                 URL:
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin, process forking
>    Affects Versions: 2.13
>         Environment: Any environment in which the file encoding is distinct from ${}.
>            Reporter: Stephan Schroevers
>         Attachments: file-encoding-example.tbz
> It appears that Surefire doesn't (correctly) set {{-Dfile.encoding=$\{\}}}
prior to running the tests. As a result the JVM will derive {{file.encoding}} from the environment's
file encoding. This affects the return value of {{java.nio.charset.Charset#defaultCharset()}},
which reads the {{file.encoding}} system property exactly once, and is invoked very early
on. Concretely this means that the unit tests are unnecessarily platform dependent.
> Thus I have two requests:
> # Make {{-Dfile.encoding=$\{\}}} the default. That is, the
following configuration setting should be implied:
> {noformat}
> <argLine>-Dfile.encoding=${}</argLine>
> {noformat}
> # Extend the method {{org.apache.maven.plugin.surefire.SurefireProperties#verifyLegalSystemProperties(org.apache.maven.plugin.logging.Log)}}
such that is warns about users attempting to set the {{file.encoding}} property through the
{{systemPropertyVariables}} configuration setting. Like with {{java.library.path}}, this does
_not_ work.
> I have [attached|^file-encoding-example.tbz] a sample project that demonstrates the issue
(simply run {{`mvn test`}}). Please have a look at the comments I added to the POM. I have
tested this sample project only on Linux, but a colleague has confirmed that an instance of
this issue can also be recreated on Windows.
> TIA for looking into this!

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message